File size: 2,268 Bytes
6756892
daaf146
 
12326ed
7d05081
b476ae0
 
 
7d05081
aac615e
daaf146
067d940
 
aac615e
067d940
7d05081
daaf146
067d940
aac615e
067d940
 
aac615e
067d940
 
aac615e
 
daaf146
2ffa216
 
067d940
daaf146
 
 
 
 
 
 
 
4232196
d66e9c7
067d940
 
aac615e
 
 
 
 
 
067d940
aac615e
 
067d940
 
aac615e
2ffa216
 
 
12326ed
2ffa216
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import streamlit as st
from pydantic_ai import Agent
from pydantic_ai.models.groq import GroqModel
import nest_asyncio
import random



random_number = random.randint(3000, 10000)
body = ""
model = GroqModel('llama-3.1-70b-versatile', api_key='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')


async def onClick(vacationType,familyType,duration,purpose,interests):
    agent = Agent(model,system_prompt=(
    f"imagine the year is {random_number} and space travel is normal", 
    "Mankind has discovered aliens some are more advance then us some are not",
    "You are a travel agent and depending on the" + vacationType +"you will list down some destinations",
    "Also answer based on "+familyType+ "," + duration +","+purpose + "and"+interests
    ))
    result_1 = agent.run_sync("for space travel which planet is the best")
    body = result_1
    print(result_1)
    
def asyncOnClick(vacationType,familyType,duration,purpose,interests):
    asyncio.run(onClick(vacationType,familyType,duration,purpose,interests))

async def main():

    #result_1 = agent.run_sync("for space travel which planet is the best")
##The Zorvath


#print(result_1.data)

#result_2 = agent.run_sync("What are the major tourust attraction in planet The Zorvath",message_history=result_1.new_messages())

#print(result_2.data)
    

    #st.markdown(result_1.data)
    #st.button(label="Search",type="primary",on_click=onClick)
    st.subheader("Travel Preferences")
    vacationType = st.selectbox(label="Travel Style",options=("Budget","Mid-budget","High-end"))
    family = st.selectbox(label="Group Size",options=("Solo","Small family","Large family","Destination weeding"))
    duration = st.selectbox(label="Duration of Trip",options=("5 days","2 weeks","1 month","more then 1 month"))
    purpose = st.selectbox(label="Purpose of Travel",options=("Honeymoon","anniversary","family vacation","corporate retreat"))
    interests = st.selectbox(label="Special Interestl",options=("Photography","gastronomy","wildlife","art"))

    st.subheader("Answer")
    st.caption(body)

    if st.button("Search"):
        asyncOnClick(vacationType,family,duration,purpose,interests)

if __name__ == '__main__':
    import asyncio
    nest_asyncio.apply()
    asyncio.run(main())