Spaces:
Runtime error
Runtime error
peter szemraj
commited on
Commit
•
b649bd8
1
Parent(s):
635e033
blacken code format
Browse files- ai_single_response.py +0 -2
- app.py +16 -5
ai_single_response.py
CHANGED
@@ -140,8 +140,6 @@ def query_gpt_model(
|
|
140 |
to_gpu=use_gpu,
|
141 |
)
|
142 |
|
143 |
-
|
144 |
-
|
145 |
p_list = [] # track conversation
|
146 |
p_list.append(speaker.lower() + ":" + "\n")
|
147 |
p_list.append(prompt_msg.lower() + "\n")
|
|
|
140 |
to_gpu=use_gpu,
|
141 |
)
|
142 |
|
|
|
|
|
143 |
p_list = [] # track conversation
|
144 |
p_list.append(speaker.lower() + ":" + "\n")
|
145 |
p_list.append(prompt_msg.lower() + "\n")
|
app.py
CHANGED
@@ -3,7 +3,16 @@ deploy-as-bot\gradio_chatbot.py
|
|
3 |
A system, method for deploying to Gradio. Gradio is a basic "deploy" interface which allows for other users to test your model from a web URL. It also enables some basic functionality like user flagging for weird responses.
|
4 |
Note that the URL is displayed once the script is run.
|
5 |
"""
|
6 |
-
from flask import
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
from ai_single_response import query_gpt_model
|
8 |
from datetime import datetime
|
9 |
from transformers import pipeline
|
@@ -19,10 +28,10 @@ import sys
|
|
19 |
from os.path import dirname
|
20 |
import nltk
|
21 |
|
22 |
-
nltk.download(
|
23 |
|
24 |
sys.path.append(dirname(dirname(os.path.abspath(__file__))))
|
25 |
-
#from gradio.networking import get_state, set_state
|
26 |
warnings.filterwarnings(action="ignore", message=".*gradient_checkpointing*")
|
27 |
logging.basicConfig()
|
28 |
cwd = Path.cwd()
|
@@ -101,7 +110,6 @@ def chat(message):
|
|
101 |
return html
|
102 |
|
103 |
|
104 |
-
|
105 |
def get_parser():
|
106 |
"""
|
107 |
get_parser - a helper function for the argparse module
|
@@ -161,4 +169,7 @@ if __name__ == "__main__":
|
|
161 |
)
|
162 |
|
163 |
# launch the gradio interface and start the server
|
164 |
-
iface.launch(
|
|
|
|
|
|
|
|
3 |
A system, method for deploying to Gradio. Gradio is a basic "deploy" interface which allows for other users to test your model from a web URL. It also enables some basic functionality like user flagging for weird responses.
|
4 |
Note that the URL is displayed once the script is run.
|
5 |
"""
|
6 |
+
from flask import (
|
7 |
+
Flask,
|
8 |
+
request,
|
9 |
+
session,
|
10 |
+
jsonify,
|
11 |
+
abort,
|
12 |
+
send_file,
|
13 |
+
render_template,
|
14 |
+
redirect,
|
15 |
+
)
|
16 |
from ai_single_response import query_gpt_model
|
17 |
from datetime import datetime
|
18 |
from transformers import pipeline
|
|
|
28 |
from os.path import dirname
|
29 |
import nltk
|
30 |
|
31 |
+
nltk.download("stopwords") # still unsure where this error originates from
|
32 |
|
33 |
sys.path.append(dirname(dirname(os.path.abspath(__file__))))
|
34 |
+
# from gradio.networking import get_state, set_state
|
35 |
warnings.filterwarnings(action="ignore", message=".*gradient_checkpointing*")
|
36 |
logging.basicConfig()
|
37 |
cwd = Path.cwd()
|
|
|
110 |
return html
|
111 |
|
112 |
|
|
|
113 |
def get_parser():
|
114 |
"""
|
115 |
get_parser - a helper function for the argparse module
|
|
|
169 |
)
|
170 |
|
171 |
# launch the gradio interface and start the server
|
172 |
+
iface.launch(
|
173 |
+
share=True,
|
174 |
+
enable_queue=True,
|
175 |
+
)
|