File size: 1,395 Bytes
b310d09
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# ///////////////////////////////////////////////////////////////////////////////////////////////////////////
# Aqui probamos los propmts, en caso que no funcione apropiadamente usaremos finetuning con la db
# Ejemplo de prompt basico
Class Prompt_Gen():

    prompt = "Generate a graph idea based on European fertility data."
    output = generator(prompt, max_length=50, num_return_sequences=1)[0]['generated_text']

# 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 
# Vamos a generar un codigo para luego ejecutarlo con un exec() y poder imprimir en Streamlit st.pyplot()

    def generate_graph_prompt(country1, country2, metric, start_year, end_year):
    
        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.

        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}.

        Also, provide a concise explanation of what this graph represents for an end user who might not be familiar with the data.
        """
        return prompt

# Ejemplo de como quedaria el prompt que recibiria el modelo

prompt = generate_graph_prompt("Germany", "France", "fertility rate", 2020, 2030)