Skip to content

Commit

Permalink
Commit update project
Browse files Browse the repository at this point in the history
  • Loading branch information
anapamponet committed Oct 17, 2024
0 parents commit ca33ffe
Show file tree
Hide file tree
Showing 13 changed files with 408 additions and 0 deletions.
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
OPENAI_API_KEY='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'
6 changes: 6 additions & 0 deletions .idea/inspectionProfiles/profiles_settings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions .idea/resumocast_ailabs.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

80 changes: 80 additions & 0 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

58 changes: 58 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Gerador de Ideias de Startups

Este projeto usa a API do ChatGPT para gerar conceitos inovadores de startups com base em descrições fornecidas pelos usuários.

## Instalação

1. Clone o repositório:
```bash
git clone https://github.com/marceloc4rdoso/ailabs.git

2. Criação do Ambiente Virtual:
```bash
python3 -m venv venv
source venv/bin/activate # No Windows: venv\Scripts\activate
3. Estrutura do Projeto:
```bash
projeto_startup/
├── .env (deve ser inserido com sua api key)
├── app.py
├── README.md
├── requirements.txt
├── static/
│ └── img
│ └── scripts.js
│ └── style.csss
├── templates/
└── index.html

4. Arquivo .env: No arquivo .env, armazene sua chave de API:
```bash
OPENAI_API_KEY='sua_openai_api_key_aqui'
5. Inicie a aplicação:
```bash
python app.py
6. Acesse a aplicação em http://localhost:5001


### OBS.: **Requisitos e Considerações**
- **Chave da API**: Certifique-se de manter a chave da OpenAI em local seguro (como um arquivo `.env`).
- **Limites de uso**: A API da OpenAI tem limites de uso, por isso é importante monitorar o uso de tokens.

### **Manual de uso**
Acesse a página principal e insira um conceito ou área para a qual deseja gerar uma ideia de startup.
Clique em "Gerar Ideia" e aguarde a sugestão.

### Desenvolvedores
#### Licença
Este projeto está licenciado sob a MIT License.
#### Como Usar
Contribuição
Contribuições são bem-vindas! Sinta-se à vontade para abrir uma issue ou enviar um pull request.
#### Caso necessite
```bash
### Passo 5: Adicionar `requirements.txt`
Gere o `requirements.txt` para que outros possam instalar as dependências com facilidade:
```bash
pip freeze > requirements.txt

55 changes: 55 additions & 0 deletions app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import os
from flask import Flask, request, render_template, jsonify
from dotenv import load_dotenv
from openai import OpenAI

# Carregar variáveis de ambiente do arquivo .env
load_dotenv()

client = OpenAI(
api_key = os.getenv("OPENAI_API_KEY")
)

app = Flask(__name__)

@app.route('/')
def home():
return render_template('index.html')

@app.route('/gerar_ideia', methods=['POST'])
def gerar_ideia():
input_usuario = request.form.get('input')
# Chamada à API do ChatGPT
try:
# Definindo o contexto do tema
tema = '''Gerar ideias inovadoras para startups com o auxilio da expertise dos profissionais da ResumoCast.
oferecendo cursos, programas de buildagem e outras iniciativas educativas,
todas projetadas para impulsionar o desenvolvimento pessoal e profissional.
Com anos de experiência e um histórico comprovado no ecossistema empreendedor,
a ResumoCast Ventures se estabeleceu como uma referência no mercado,
ajudando a moldar a próxima geração de líderes empresariais no Brasil.
Para gerar ideias inovadoras para startups,
é essencial observar problemas cotidianos e identificar lacunas que ainda não foram resolvidas ou que podem ser abordadas de maneira mais eficiente.
A pesquisa de tendências emergentes, como novas tecnologias ou mudanças no comportamento dos consumidores, pode inspirar soluções criativas.
Conversar com potenciais usuários e entender suas dores também é uma excelente maneira de descobrir oportunidades inexploradas. Além disso,
colaborar com profissionais de diferentes áreas pode gerar insights únicos ao combinar conhecimentos diversos. Por fim,
estar disposto a experimentar e ajustar ideias com base em feedback real é fundamental para transformar conceitos inovadores em startups de sucesso.
'''

response = client.chat.completions.create(
model="gpt-4o-mini-2024-07-18",
messages=[
{"role": "system", "content": tema}, # Definindo o tema na mensagem do sistema
{"role": "user", "content": f"Crie uma ideia de startup baseada no seguinte input: {input_usuario}"}
],
max_tokens=150
)

ideia = response['choices'][0]['message']['content']
return jsonify({"ideia": ideia})

except Exception as e:
return jsonify({"error": str(e)})

if __name__ == '__main__':
app.run(host='0.0.0.0', port=5001, debug=True)
3 changes: 3 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
flask
openai~=1.51.2
python-dotenv~=1.0.1
10 changes: 10 additions & 0 deletions static/scripts.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
document.getElementById('formulario').onsubmit = async function (e) {
e.preventDefault();
const formData = new FormData(this);
const response = await fetch('/gerar_ideia', {
method: 'POST',
body: formData
});
const data = await response.json();
document.getElementById('resultado').innerText = data.ideia || data.error;
}
135 changes: 135 additions & 0 deletions static/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
/* Estilo básico para o corpo */
body {
font-family: Arial, sans-serif;
background-color: #f0f0f0;
color: #333;
margin: 0;
padding: 0;
display: flex;
flex-direction: column;
align-items: center;
justify-content: flex-start;
height: 100vh;
}
/* Estilo para o cabeçalho */
header {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
background-color: #FF7043;
padding: 10px;
width: 100%;
box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.1);
}

/* Estilo para a logomarca */
.logo {
width: 80px;
height: 80px;
padding: 5px;
object-fit: contain;
border-radius: 15px;
}

/* Estilo para o título no cabeçalho */
header h1 {
color: white;
font-size: 24px;
font-weight: bold;
margin-top: 5px;
text-align: center;
}

/* Estilo para o título */
h1 {
text-align: center;
padding: 20px;
color: #FF7043;
margin: 20px auto;
max-width: 90%;
font-size: 2.5rem;
}

/* Estilo para o formulário */
form {
background-color: white;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
width: 50%;
padding: 20px;
border-radius: 10px;
box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.1);
text-align: center;
}


/* Estilo para o textarea */
textarea {
width: 50%;
max-width: 400px;
padding: 10px;
margin-bottom: 20px;
border: 1px solid #ccc;
border-radius: 10px;
font-size: 16px;
resize: none;
margin-bottom: 20px;
}

/* Estilo do botão */
button {
background-color: #FF5722;
color: white;
padding: 10px;
border: none;
border-radius: 5px;
font-size: 16px;
cursor: pointer;
width: 30%;
}

button:hover {
background-color: #E64A19;
}

/* Estilo para o resultado */
#resultado {
display: flex;
flex-direction: column;
width: 50%;
padding: 10px;
background-color: #f9f9f9;
margin-top: 20px;
border-radius: 10px;
box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.1);
text-align: center;
font-style: italic;
color: #FF7043;
}
/* Estilo para o rodapé */
footer {
width: 100%;
background-color: #E65100;
color: white;
text-align: left;
padding: 10px;
position: fixed;
bottom: 0;
left: 0;
box-shadow: 0px -4px 6px rgba(0, 0, 0, 0.1);
font-size: 14px;
}

/* Tornar a página responsiva */
@media (max-width: 600px) {
form {
width: 90%;
}

#resultado {
width: 90%;
}
}
Loading

0 comments on commit ca33ffe

Please sign in to comment.