Spaces:
Sleeping
Sleeping
un-index
commited on
Commit
·
5e06490
1
Parent(s):
dd62ca3
- app.py +18 -15
- requirements.txt +1 -4
app.py
CHANGED
|
@@ -20,15 +20,18 @@ import gradio as gr
|
|
| 20 |
|
| 21 |
import requests
|
| 22 |
def f(text):
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
|
|
|
|
|
|
|
|
|
| 32 |
return response.text
|
| 33 |
|
| 34 |
|
|
@@ -39,13 +42,13 @@ iface.launch(enable_queue=True)
|
|
| 39 |
# all below works but testing
|
| 40 |
# import gradio as gr
|
| 41 |
|
| 42 |
-
title = "GPT-J-6B"
|
| 43 |
|
| 44 |
-
examples = [
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
]
|
| 49 |
|
| 50 |
# gr.Interface.load("huggingface/EleutherAI/gpt-j-6B",
|
| 51 |
# inputs=gr.inputs.Textbox(lines=10, label="Input Text"),
|
|
|
|
| 20 |
|
| 21 |
import requests
|
| 22 |
def f(text):
|
| 23 |
+
try:
|
| 24 |
+
context = text
|
| 25 |
+
payload = {
|
| 26 |
+
"context": context,
|
| 27 |
+
"token_max_length": 512,
|
| 28 |
+
"temperature": 1.0,
|
| 29 |
+
"top_p": 0.9,
|
| 30 |
+
}
|
| 31 |
+
response = requests.post("http://api.vicgalle.net:5000/generate", params=payload).json()
|
| 32 |
+
# http://api.vicgalle.net:5000/docs#/default/generate_generate_post
|
| 33 |
+
except Exception as e:
|
| 34 |
+
return "error: \n"+str(e)
|
| 35 |
return response.text
|
| 36 |
|
| 37 |
|
|
|
|
| 42 |
# all below works but testing
|
| 43 |
# import gradio as gr
|
| 44 |
|
| 45 |
+
# title = "GPT-J-6B"
|
| 46 |
|
| 47 |
+
# examples = [
|
| 48 |
+
# ['The tower is 324 metres (1,063 ft) tall,'],
|
| 49 |
+
# ["The Moon's orbit around Earth has"],
|
| 50 |
+
# ["The smooth Borealis basin in the Northern Hemisphere covers 40%"]
|
| 51 |
+
# ]
|
| 52 |
|
| 53 |
# gr.Interface.load("huggingface/EleutherAI/gpt-j-6B",
|
| 54 |
# inputs=gr.inputs.Textbox(lines=10, label="Input Text"),
|
requirements.txt
CHANGED
|
@@ -1,4 +1 @@
|
|
| 1 |
-
|
| 2 |
-
flax
|
| 3 |
-
tensorflow
|
| 4 |
-
torch
|
|
|
|
| 1 |
+
requests
|
|
|
|
|
|
|
|
|