Spaces:
Running
Running
Update prompt.py
Browse files
prompt.py
CHANGED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# ///////////////////////////////////////////////////////////////////////////////////////////////////////////
|
2 |
+
# Aqui probamos los propmts, en caso que no funcione apropiadamente usaremos finetuning con la db
|
3 |
+
# Ejemplo de prompt basico
|
4 |
+
Class Prompt_Gen():
|
5 |
+
|
6 |
+
prompt = "Generate a graph idea based on European fertility data."
|
7 |
+
output = generator(prompt, max_length=50, num_return_sequences=1)[0]['generated_text']
|
8 |
+
|
9 |
+
# Aqui vamos a añadir los prompts, comparativa entre paises, lo ideal es mas de uno, pero podriamos iniciar en un 1v1 con la metrica
|
10 |
+
# Vamos a generar un codigo para luego ejecutarlo con un exec() y poder imprimir en Streamlit st.pyplot()
|
11 |
+
|
12 |
+
def generate_graph_prompt(country1, country2, metric, start_year, end_year):
|
13 |
+
|
14 |
+
prompt = f"""You have access to a database of European countries with data on {metric}, labor force participation, population, and their predictions for future years.
|
15 |
+
|
16 |
+
Generate Python code using matplotlib to create a line graph showing the trend of {metric} for {country1} and {country2} from {start_year} to {end_year}.
|
17 |
+
|
18 |
+
Also, provide a concise explanation of what this graph represents for an end user who might not be familiar with the data.
|
19 |
+
"""
|
20 |
+
return prompt
|
21 |
+
|
22 |
+
# Ejemplo de como quedaria el prompt que recibiria el modelo
|
23 |
+
|
24 |
+
prompt = generate_graph_prompt("Germany", "France", "fertility rate", 2020, 2030)
|