Spaces:
Runtime error
Runtime error
Peter Szemraj
commited on
Commit
•
253dc63
1
Parent(s):
c3b001a
replace almost everything
Browse files- README.md +30 -6
- app.py +13 -13
- converse.py +1 -1
- grammar_improve.py +0 -8
- requirements.txt +16 -10
README.md
CHANGED
@@ -1,13 +1,37 @@
|
|
1 |
---
|
2 |
-
title:
|
3 |
-
emoji:
|
4 |
-
colorFrom:
|
5 |
-
colorTo:
|
6 |
sdk: gradio
|
7 |
app_file: app.py
|
8 |
pinned: false
|
9 |
---
|
10 |
|
11 |
-
#
|
12 |
|
13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
+
title: Test Xl Bp
|
3 |
+
emoji: 👀
|
4 |
+
colorFrom: green
|
5 |
+
colorTo: indigo
|
6 |
sdk: gradio
|
7 |
app_file: app.py
|
8 |
pinned: false
|
9 |
---
|
10 |
|
11 |
+
# Configuration
|
12 |
|
13 |
+
`title`: _string_
|
14 |
+
Display title for the Space
|
15 |
+
|
16 |
+
`emoji`: _string_
|
17 |
+
Space emoji (emoji-only character allowed)
|
18 |
+
|
19 |
+
`colorFrom`: _string_
|
20 |
+
Color for Thumbnail gradient (red, yellow, green, blue, indigo, purple, pink, gray)
|
21 |
+
|
22 |
+
`colorTo`: _string_
|
23 |
+
Color for Thumbnail gradient (red, yellow, green, blue, indigo, purple, pink, gray)
|
24 |
+
|
25 |
+
`sdk`: _string_
|
26 |
+
Can be either `gradio` or `streamlit`
|
27 |
+
|
28 |
+
`sdk_version` : _string_
|
29 |
+
Only applicable for `streamlit` SDK.
|
30 |
+
See [doc](https://hf.co/docs/hub/spaces) for more info on supported versions.
|
31 |
+
|
32 |
+
`app_file`: _string_
|
33 |
+
Path to your main application file (which contains either `gradio` or `streamlit` Python code).
|
34 |
+
Path is relative to the root of the repository.
|
35 |
+
|
36 |
+
`pinned`: _boolean_
|
37 |
+
Whether the Space stays on top of your list.
|
app.py
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
"""
|
2 |
-
app.py - the main file for the app. This creates the flask app and handles the routes.
|
3 |
|
4 |
"""
|
5 |
|
@@ -44,7 +44,6 @@ cwd = Path.cwd()
|
|
44 |
my_cwd = str(cwd.resolve()) # string so it can be passed to os.path() objects
|
45 |
|
46 |
|
47 |
-
|
48 |
def chat(trivia_query):
|
49 |
history = []
|
50 |
response = ask_gpt(message=trivia_query, chat_pipe=my_chatbot)
|
@@ -182,20 +181,21 @@ if __name__ == "__main__":
|
|
182 |
inputs=["text"],
|
183 |
outputs="html",
|
184 |
examples=[
|
185 |
-
"How
|
186 |
-
"What
|
187 |
-
"
|
188 |
-
"
|
189 |
-
"
|
190 |
-
"
|
191 |
-
"
|
192 |
-
"
|
193 |
-
"
|
194 |
-
"
|
|
|
195 |
],
|
196 |
title=f"Ballpark Trivia: {default_model} Model",
|
197 |
description=f"Are you frequently asked google-able Trivia questions and annoyed by it? Well, this is the app for you! Ballpark Trivia Bot answers any trivia question with something that sounds plausible but is probably not 100% correct. \n\n One might say.. the answers are in the right ballpark.",
|
198 |
-
article="Further details can be found in the
|
199 |
"**Important Notes & About:**\n\n"
|
200 |
"1. the model can take up to 60 seconds to respond sometimes, patience is a virtue.\n"
|
201 |
"2. the model started from a pretrained checkpoint, and was trained on several different datasets. Anything it says should be fact-checked before being regarded as a true statement.\n"
|
|
|
1 |
"""
|
2 |
+
app.py - the main file for the app. This creates the flask app and handles the routes.
|
3 |
|
4 |
"""
|
5 |
|
|
|
44 |
my_cwd = str(cwd.resolve()) # string so it can be passed to os.path() objects
|
45 |
|
46 |
|
|
|
47 |
def chat(trivia_query):
|
48 |
history = []
|
49 |
response = ask_gpt(message=trivia_query, chat_pipe=my_chatbot)
|
|
|
181 |
inputs=["text"],
|
182 |
outputs="html",
|
183 |
examples=[
|
184 |
+
"How have you been doing lately?",
|
185 |
+
"What is the common name for a horse-drawn carriage used in city streets?",
|
186 |
+
"What day of the week was November 8, 2016?",
|
187 |
+
"What is Katy Perry's birthday?",
|
188 |
+
"What is the name of the first American president?",
|
189 |
+
"Who was the first person to walk on the moon?",
|
190 |
+
"explain the difference between a 'dumb' and a 'smart' person",
|
191 |
+
"What is written on the back of a $5 bill?",
|
192 |
+
"If a rooster lays an egg on the equator, will it roll east or west?",
|
193 |
+
"rate your overall satisfaction with the chatbot",
|
194 |
+
"How many icebergs are in the ocean?",
|
195 |
],
|
196 |
title=f"Ballpark Trivia: {default_model} Model",
|
197 |
description=f"Are you frequently asked google-able Trivia questions and annoyed by it? Well, this is the app for you! Ballpark Trivia Bot answers any trivia question with something that sounds plausible but is probably not 100% correct. \n\n One might say.. the answers are in the right ballpark.",
|
198 |
+
article="Further details can be found in the [model card](https://huggingface.co/pszemraj/Ballpark-Trivia-L). If you are interested in a more deceptively incorrect model, there is also [an XL version](https://huggingface.co/pszemraj/Ballpark-Trivia-XL) on my page.\n\n"
|
199 |
"**Important Notes & About:**\n\n"
|
200 |
"1. the model can take up to 60 seconds to respond sometimes, patience is a virtue.\n"
|
201 |
"2. the model started from a pretrained checkpoint, and was trained on several different datasets. Anything it says should be fact-checked before being regarded as a true statement.\n"
|
converse.py
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
"""
|
2 |
-
converse.py - this script has functions for handling the conversation between the user and the bot.
|
3 |
|
4 |
https://huggingface.co/docs/transformers/v4.15.0/en/main_classes/model#transformers.generation_utils.GenerationMixin.generate.no_repeat_ngram_size
|
5 |
"""
|
|
|
1 |
"""
|
2 |
+
converse.py - this script has functions for handling the conversation between the user and the bot.
|
3 |
|
4 |
https://huggingface.co/docs/transformers/v4.15.0/en/main_classes/model#transformers.generation_utils.GenerationMixin.generate.no_repeat_ngram_size
|
5 |
"""
|
grammar_improve.py
CHANGED
@@ -101,14 +101,6 @@ def remove_trailing_punctuation(text: str, fuLL_strip=False):
|
|
101 |
return text.strip(".,;:")
|
102 |
|
103 |
|
104 |
-
def fix_punct_spacing(text: str):
|
105 |
-
fix_spaces = re.compile(r"\s*([?!.,]+(?:\s+[?!.,]+)*)\s*")
|
106 |
-
spc_text = fix_spaces.sub(lambda x: "{} ".format(x.group(1).replace(" ", "")), text)
|
107 |
-
cln_text = re.sub(r"(\W)(?=\1)", "", spc_text)
|
108 |
-
|
109 |
-
return cln_text
|
110 |
-
|
111 |
-
|
112 |
"""
|
113 |
start of SymSpell code
|
114 |
"""
|
|
|
101 |
return text.strip(".,;:")
|
102 |
|
103 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
104 |
"""
|
105 |
start of SymSpell code
|
106 |
"""
|
requirements.txt
CHANGED
@@ -1,10 +1,16 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
transformers>=4.12.5
|
2 |
+
sentencepiece>=0.1.96
|
3 |
+
tqdm>=4.43.0
|
4 |
+
symspellpy>=6.7.0
|
5 |
+
requests>=2.24.0
|
6 |
+
gradio>=2.4.6
|
7 |
+
natsort>=7.1.1
|
8 |
+
pandas>=1.3.0
|
9 |
+
aitextgen>=0.5.2
|
10 |
+
clean-text>=0.5.0
|
11 |
+
openwa>=1.3.16
|
12 |
+
python-telegram-bot>=13.0
|
13 |
+
webwhatsapi>=2.0.5
|
14 |
+
Flask>=2.0.2
|
15 |
+
nltk>=3.6.6
|
16 |
+
neuspell>=1.0.0
|