Spaces:
Running
Running
Update main.py
Browse files
main.py
CHANGED
@@ -98,6 +98,10 @@ class imageInput(BaseModel):
|
|
98 |
class ReportInput(BaseModel):
|
99 |
topic: str = Query(default="market research",description="The main topic for the report")
|
100 |
description: str = Query(default="",description="A brief description of the topic")
|
|
|
|
|
|
|
|
|
101 |
|
102 |
@app.get("/", tags=["Home"])
|
103 |
def api_home():
|
@@ -119,18 +123,20 @@ async def fetch_images(input: imageInput):
|
|
119 |
return {"images": images}
|
120 |
|
121 |
@app.post("/get_recommendations")
|
122 |
-
async def generate_recommendations(input:
|
123 |
|
124 |
if input.user_input:
|
125 |
-
prompt = f"""create a list of {input.
|
126 |
else:
|
127 |
-
prompt = f"""create a list of mixed {input.
|
128 |
|
129 |
-
|
130 |
-
response_topics = json_from_text(
|
131 |
together_response(
|
132 |
prompt, model="meta-llama/Llama-3-8b-chat-hf", SysPrompt=SysPromptList,temperature=1
|
133 |
)
|
134 |
)
|
135 |
return {"recommendations": response_topics}
|
|
|
|
|
|
|
136 |
|
|
|
98 |
class ReportInput(BaseModel):
|
99 |
topic: str = Query(default="market research",description="The main topic for the report")
|
100 |
description: str = Query(default="",description="A brief description of the topic")
|
101 |
+
|
102 |
+
class RecommendationInput(BaseModel):
|
103 |
+
user_input: str = Query(default="", description="Input query to generate follow-up questions")
|
104 |
+
num_recommendations: int = Query(default=5, description="Number of recommendations to generate")
|
105 |
|
106 |
@app.get("/", tags=["Home"])
|
107 |
def api_home():
|
|
|
123 |
return {"images": images}
|
124 |
|
125 |
@app.post("/get_recommendations")
|
126 |
+
async def generate_recommendations(input: RecommendationInput):
|
127 |
|
128 |
if input.user_input:
|
129 |
+
prompt = f"""create a list of {input.num_recommendations} questions that a user might ask following the question: {input.user_input}:"""
|
130 |
else:
|
131 |
+
prompt = f"""create a list of mixed {input.num_recommendations} questions to create a report or plan or course on any of the topics product,market,research topic """
|
132 |
|
133 |
+
response_topics = json_from_text(
|
|
|
134 |
together_response(
|
135 |
prompt, model="meta-llama/Llama-3-8b-chat-hf", SysPrompt=SysPromptList,temperature=1
|
136 |
)
|
137 |
)
|
138 |
return {"recommendations": response_topics}
|
139 |
+
|
140 |
+
|
141 |
+
|
142 |
|