Spaces:
Runtime error
Runtime error
aus10powell
commited on
Commit
•
7d2a165
1
Parent(s):
7fac423
Update app.py
Browse files
app.py
CHANGED
@@ -174,18 +174,16 @@ async def get_sentiment(username: str) -> Dict[str, Dict[str, float]]:
|
|
174 |
|
175 |
|
176 |
@app.post("/api/generate")
|
177 |
-
# async def generate_text(account: str, text: str):
|
178 |
async def generate_text(request: Request):
|
179 |
-
print("*"*50)
|
180 |
data = await request.json()
|
181 |
-
print("*"*50)
|
182 |
print("POST Request:")
|
183 |
|
184 |
# Check length of input, if it is greater than 10 tokens, the text is sent off to a summarizer to generate:
|
185 |
|
186 |
-
|
187 |
generated_text = generative.generate_account_text(
|
188 |
-
prompt=data[
|
189 |
)
|
190 |
# return one example
|
191 |
generated_text = generated_text[0]["generated_text"]
|
@@ -202,7 +200,6 @@ async def generate_text(request: Request):
|
|
202 |
unique_sentences.add(sentence)
|
203 |
final_text = " ".join(non_duplicate_sentences[:-1])
|
204 |
|
205 |
-
|
206 |
return {"generated_text": final_text}
|
207 |
|
208 |
@app.get("/examples1")
|
|
|
174 |
|
175 |
|
176 |
@app.post("/api/generate")
|
|
|
177 |
async def generate_text(request: Request):
|
178 |
+
print("*" * 50)
|
179 |
data = await request.json()
|
180 |
+
print("*" * 50)
|
181 |
print("POST Request:")
|
182 |
|
183 |
# Check length of input, if it is greater than 10 tokens, the text is sent off to a summarizer to generate:
|
184 |
|
|
|
185 |
generated_text = generative.generate_account_text(
|
186 |
+
prompt=data["text"], model_dir=os.path.join(models_path, data["account"])
|
187 |
)
|
188 |
# return one example
|
189 |
generated_text = generated_text[0]["generated_text"]
|
|
|
200 |
unique_sentences.add(sentence)
|
201 |
final_text = " ".join(non_duplicate_sentences[:-1])
|
202 |
|
|
|
203 |
return {"generated_text": final_text}
|
204 |
|
205 |
@app.get("/examples1")
|