Spaces:
Runtime error
Runtime error
upload app.py
Browse files
app.py
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import requests
|
2 |
+
from flask import Flask
|
3 |
+
import os
|
4 |
+
|
5 |
+
|
6 |
+
app = Flask(__name__)
|
7 |
+
|
8 |
+
|
9 |
+
@app.route('/')
|
10 |
+
def get_gpt_response(text):
|
11 |
+
|
12 |
+
r = requests.post(
|
13 |
+
url="https://hf.space/embed/singh5587/gpt-j-6b/+/api/predict ",
|
14 |
+
json={"data": [text]},
|
15 |
+
)
|
16 |
+
response = r.json()
|
17 |
+
return response["data"][0]
|
18 |
+
|
19 |
+
|
20 |
+
get_gpt_response('hello')
|
21 |
+
|
22 |
+
|
23 |
+
|
24 |
+
if __name__ == "__main__":
|
25 |
+
app.run()
|