Spaces:
Running
Running
hyzhang00
commited on
Commit
·
619b05e
1
Parent(s):
71c3325
update on code
Browse files- .gitignore +1 -7
- app.py +9 -2
- assets/test_images/1.The Ambassadors.jpg +0 -0
- assets/test_images/2.Football Players.jpg +0 -0
- assets/test_images/3-square.jpg +3 -0
- assets/test_images/3.Along the River during the Qingming Festival.jpeg +3 -0
- assets/test_images/MUS.png +0 -0
- assets/test_images/Picture0.png +0 -0
- assets/test_images/Picture1.png +0 -0
- assets/test_images/Picture10.png +0 -0
- assets/test_images/Picture2.png +0 -0
- assets/test_images/Picture3.png +0 -0
- assets/test_images/Picture4.png +0 -0
- assets/test_images/Picture5.png +0 -0
- assets/test_images/Picture6.png +0 -0
- assets/test_images/Picture7.png +0 -0
- assets/test_images/Picture8.png +0 -0
- assets/test_images/Picture9.png +0 -0
- assets/test_images/img36.webp +0 -0
- assets/test_images/pearl.jpg +0 -0
- assets/test_images/qingming3.jpeg +3 -0
- assets/test_images/task1.jpg +0 -0
- assets/test_images/task2.jpg +0 -0
- assets/test_images/task3.jpg +0 -0
- assets/test_images/task4.jpg +0 -0
- assets/test_images/task5.jpg +0 -0
- assets/test_images/test1.jpg +3 -0
- assets/test_images/test2.jpg +0 -0
- assets/test_images/test3.jpg +3 -0
- assets/test_images/test4.jpg +0 -0
- assets/test_images/test5.jpg +0 -0
.gitignore
CHANGED
@@ -2,13 +2,7 @@ result/
|
|
2 |
model_cache/
|
3 |
*.pth
|
4 |
teng_grad_start.sh
|
5 |
-
|
6 |
-
*.jpeg
|
7 |
-
*.png
|
8 |
-
*.svg
|
9 |
-
*.gif
|
10 |
-
*.tiff
|
11 |
-
*.webp
|
12 |
|
13 |
|
14 |
# Byte-compiled / optimized / DLL files
|
|
|
2 |
model_cache/
|
3 |
*.pth
|
4 |
teng_grad_start.sh
|
5 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
|
7 |
|
8 |
# Byte-compiled / optimized / DLL files
|
app.py
CHANGED
@@ -111,12 +111,19 @@ async def init_openai_api_key(api_key=""):
|
|
111 |
if api_key and len(api_key) > 30:
|
112 |
print(api_key)
|
113 |
if validate_api_key(api_key):
|
114 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
115 |
else:
|
116 |
print("Invalid API key.")
|
117 |
else:
|
118 |
print("API key is too short.")
|
119 |
-
return [gr.update(visible=False)]*
|
120 |
|
121 |
|
122 |
def get_click_prompt(chat_input, click_state, click_mode):
|
|
|
111 |
if api_key and len(api_key) > 30:
|
112 |
print(api_key)
|
113 |
if validate_api_key(api_key):
|
114 |
+
try:
|
115 |
+
# text_refiner = build_text_refiner(args.text_refiner, args.device, args, api_key)
|
116 |
+
text_refiner = None
|
117 |
+
print("text refiner")
|
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)]*3 + [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)]*6 + [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):
|
assets/test_images/1.The Ambassadors.jpg
ADDED
![]() |
assets/test_images/2.Football Players.jpg
ADDED
![]() |
assets/test_images/3-square.jpg
ADDED
![]() |
Git LFS Details
|
assets/test_images/3.Along the River during the Qingming Festival.jpeg
ADDED
![]() |
Git LFS Details
|
assets/test_images/MUS.png
ADDED
![]() |
assets/test_images/Picture0.png
ADDED
![]() |
assets/test_images/Picture1.png
ADDED
![]() |
assets/test_images/Picture10.png
ADDED
![]() |
assets/test_images/Picture2.png
ADDED
![]() |
assets/test_images/Picture3.png
ADDED
![]() |
assets/test_images/Picture4.png
ADDED
![]() |
assets/test_images/Picture5.png
ADDED
![]() |
assets/test_images/Picture6.png
ADDED
![]() |
assets/test_images/Picture7.png
ADDED
![]() |
assets/test_images/Picture8.png
ADDED
![]() |
assets/test_images/Picture9.png
ADDED
![]() |
assets/test_images/img36.webp
ADDED
![]() |
assets/test_images/pearl.jpg
ADDED
![]() |
assets/test_images/qingming3.jpeg
ADDED
![]() |
Git LFS Details
|
assets/test_images/task1.jpg
ADDED
![]() |
assets/test_images/task2.jpg
ADDED
![]() |
assets/test_images/task3.jpg
ADDED
![]() |
assets/test_images/task4.jpg
ADDED
![]() |
assets/test_images/task5.jpg
ADDED
![]() |
assets/test_images/test1.jpg
ADDED
![]() |
Git LFS Details
|
assets/test_images/test2.jpg
ADDED
![]() |
assets/test_images/test3.jpg
ADDED
![]() |
Git LFS Details
|
assets/test_images/test4.jpg
ADDED
![]() |
assets/test_images/test5.jpg
ADDED
![]() |