Spaces:
Running
Running
hyzhang00
commited on
Commit
·
f18fd81
1
Parent(s):
619b05e
update on code
Browse files- .gitignore +0 -112
- app.py +3 -3
.gitignore
CHANGED
|
@@ -1,20 +1,9 @@
|
|
| 1 |
-
result/
|
| 2 |
-
model_cache/
|
| 3 |
-
*.pth
|
| 4 |
-
teng_grad_start.sh
|
| 5 |
-
|
| 6 |
|
| 7 |
-
|
| 8 |
-
# Byte-compiled / optimized / DLL files
|
| 9 |
__pycache__/
|
| 10 |
*.py[cod]
|
| 11 |
*$py.class
|
| 12 |
result/
|
| 13 |
|
| 14 |
-
# C extensions
|
| 15 |
-
*.so
|
| 16 |
-
|
| 17 |
-
# Distribution / packaging
|
| 18 |
.Python
|
| 19 |
build/
|
| 20 |
develop-eggs/
|
|
@@ -34,104 +23,3 @@ share/python-wheels/
|
|
| 34 |
.installed.cfg
|
| 35 |
*.egg
|
| 36 |
MANIFEST
|
| 37 |
-
|
| 38 |
-
# PyInstaller
|
| 39 |
-
# Usually these files are written by a python script from a template
|
| 40 |
-
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
| 41 |
-
*.manifest
|
| 42 |
-
*.spec
|
| 43 |
-
|
| 44 |
-
# Installer logs
|
| 45 |
-
pip-log.txt
|
| 46 |
-
pip-delete-this-directory.txt
|
| 47 |
-
|
| 48 |
-
# Unit test / coverage reports
|
| 49 |
-
htmlcov/
|
| 50 |
-
.tox/
|
| 51 |
-
.nox/
|
| 52 |
-
.coverage
|
| 53 |
-
.coverage.*
|
| 54 |
-
.cache
|
| 55 |
-
nosetests.xml
|
| 56 |
-
coverage.xml
|
| 57 |
-
*.cover
|
| 58 |
-
*.py,cover
|
| 59 |
-
.hypothesis/
|
| 60 |
-
.pytest_cache/
|
| 61 |
-
|
| 62 |
-
# Translations
|
| 63 |
-
*.mo
|
| 64 |
-
*.pot
|
| 65 |
-
|
| 66 |
-
# Django stuff:
|
| 67 |
-
*.log
|
| 68 |
-
local_settings.py
|
| 69 |
-
db.sqlite3
|
| 70 |
-
db.sqlite3-journal
|
| 71 |
-
|
| 72 |
-
# Flask stuff:
|
| 73 |
-
instance/
|
| 74 |
-
.webassets-cache
|
| 75 |
-
|
| 76 |
-
# Scrapy stuff:
|
| 77 |
-
.scrapy
|
| 78 |
-
|
| 79 |
-
# Sphinx documentation
|
| 80 |
-
docs/_build/
|
| 81 |
-
|
| 82 |
-
# PyBuilder
|
| 83 |
-
target/
|
| 84 |
-
|
| 85 |
-
# Jupyter Notebook
|
| 86 |
-
.ipynb_checkpoints
|
| 87 |
-
|
| 88 |
-
# IPython
|
| 89 |
-
profile_default/
|
| 90 |
-
ipython_config.py
|
| 91 |
-
|
| 92 |
-
# pyenv
|
| 93 |
-
.python-version
|
| 94 |
-
|
| 95 |
-
# pipenv
|
| 96 |
-
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
| 97 |
-
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
| 98 |
-
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
| 99 |
-
# install all needed dependencies.
|
| 100 |
-
#Pipfile.lock
|
| 101 |
-
|
| 102 |
-
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
|
| 103 |
-
__pypackages__/
|
| 104 |
-
|
| 105 |
-
# Celery stuff
|
| 106 |
-
celerybeat-schedule
|
| 107 |
-
celerybeat.pid
|
| 108 |
-
|
| 109 |
-
# SageMath parsed files
|
| 110 |
-
*.sage.py
|
| 111 |
-
|
| 112 |
-
# Environments
|
| 113 |
-
.env
|
| 114 |
-
.venv
|
| 115 |
-
env/
|
| 116 |
-
venv/
|
| 117 |
-
ENV/
|
| 118 |
-
env.bak/
|
| 119 |
-
venv.bak/
|
| 120 |
-
|
| 121 |
-
# Spyder project settings
|
| 122 |
-
.spyderproject
|
| 123 |
-
.spyproject
|
| 124 |
-
|
| 125 |
-
# Rope project settings
|
| 126 |
-
.ropeproject
|
| 127 |
-
|
| 128 |
-
# mkdocs documentation
|
| 129 |
-
/site
|
| 130 |
-
|
| 131 |
-
# mypy
|
| 132 |
-
.mypy_cache/
|
| 133 |
-
.dmypy.json
|
| 134 |
-
dmypy.json
|
| 135 |
-
|
| 136 |
-
# Pyre type checker
|
| 137 |
-
.pyre/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
|
|
|
|
|
|
|
| 2 |
__pycache__/
|
| 3 |
*.py[cod]
|
| 4 |
*$py.class
|
| 5 |
result/
|
| 6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
.Python
|
| 8 |
build/
|
| 9 |
develop-eggs/
|
|
|
|
| 23 |
.installed.cfg
|
| 24 |
*.egg
|
| 25 |
MANIFEST
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app.py
CHANGED
|
@@ -118,13 +118,13 @@ async def init_openai_api_key(api_key=""):
|
|
| 118 |
except Exception as e:
|
| 119 |
print(f"Error initializing TextRefiner or ConversationBot: {e}")
|
| 120 |
text_refiner = None
|
| 121 |
-
return [gr.update(visible=True)]+[gr.update(visible=False)]+[gr.update(visible=True)]* 3 + [gr.update(visible=False)]*
|
| 122 |
else:
|
| 123 |
print("Invalid API key.")
|
| 124 |
else:
|
| 125 |
print("API key is too short.")
|
| 126 |
-
|
| 127 |
-
|
| 128 |
|
| 129 |
def get_click_prompt(chat_input, click_state, click_mode):
|
| 130 |
inputs = json.loads(chat_input)
|
|
|
|
| 118 |
except Exception as e:
|
| 119 |
print(f"Error initializing TextRefiner or ConversationBot: {e}")
|
| 120 |
text_refiner = None
|
| 121 |
+
return [gr.update(visible=True)]+[gr.update(visible=False)]+[gr.update(visible=True)]* 3 + [gr.update(visible=False)]*2 + [text_refiner, None]+[gr.update(visible=True)]*4+[gr.update(visible=False)]+[gr.update(visible=True)]*2
|
| 122 |
else:
|
| 123 |
print("Invalid API key.")
|
| 124 |
else:
|
| 125 |
print("API key is too short.")
|
| 126 |
+
return [gr.update(visible=False)]*5 + [gr.update(visible=True)]*2 + [text_refiner, 'Your OpenAI API Key is not available']+[gr.update(visible=False)]*7
|
| 127 |
+
|
| 128 |
|
| 129 |
def get_click_prompt(chat_input, click_state, click_mode):
|
| 130 |
inputs = json.loads(chat_input)
|