Spaces:
Sleeping
Sleeping
Update main.py
Browse files
main.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
| 1 |
import os
|
| 2 |
from flask import Flask
|
| 3 |
import threading
|
|
|
|
| 4 |
|
| 5 |
from openai import OpenAI
|
| 6 |
|
|
@@ -33,16 +34,16 @@ def server_app():
|
|
| 33 |
@app.route('/')
|
| 34 |
def server_home():
|
| 35 |
|
| 36 |
-
output = query({
|
| 37 |
"inputs": {
|
| 38 |
"source_sentence": "That is a happy person",
|
| 39 |
"sentences": [
|
| 40 |
"That is a happy dog",
|
| 41 |
"That is a very happy person",
|
| 42 |
"Today is a sunny day"
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
|
| 47 |
return str(output)
|
| 48 |
|
|
|
|
| 1 |
import os
|
| 2 |
from flask import Flask
|
| 3 |
import threading
|
| 4 |
+
import asyncio
|
| 5 |
|
| 6 |
from openai import OpenAI
|
| 7 |
|
|
|
|
| 34 |
@app.route('/')
|
| 35 |
def server_home():
|
| 36 |
|
| 37 |
+
output = asyncio.run( query({
|
| 38 |
"inputs": {
|
| 39 |
"source_sentence": "That is a happy person",
|
| 40 |
"sentences": [
|
| 41 |
"That is a happy dog",
|
| 42 |
"That is a very happy person",
|
| 43 |
"Today is a sunny day"
|
| 44 |
+
]
|
| 45 |
+
},
|
| 46 |
+
}))
|
| 47 |
|
| 48 |
return str(output)
|
| 49 |
|