Update app.py
Browse files
app.py
CHANGED
|
@@ -26,7 +26,7 @@ import atexit
|
|
| 26 |
import os
|
| 27 |
from huggingface_hub import HfApi, HfFolder
|
| 28 |
|
| 29 |
-
# Define dataset repository URL and ID
|
| 30 |
DATASET_REPO_URL = "https://huggingface.co/datasets/botsi/trust-game-llama-2-7b-chat"
|
| 31 |
DATASET_REPO_ID = "botsi/trust-game-llama-2-7b-chat"
|
| 32 |
|
|
@@ -58,7 +58,7 @@ if os.path.exists(DATA_FILE):
|
|
| 58 |
print(f"File ID: {file_info.id}")
|
| 59 |
else:
|
| 60 |
print("Data file does not exist.")
|
| 61 |
-
|
| 62 |
|
| 63 |
MAX_MAX_NEW_TOKENS = 2048
|
| 64 |
DEFAULT_MAX_NEW_TOKENS = 1024
|
|
@@ -193,7 +193,15 @@ def fetch_personalized_data(session_index):
|
|
| 193 |
return None
|
| 194 |
|
| 195 |
|
| 196 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 197 |
return """
|
| 198 |
function() {
|
| 199 |
const params = new URLSearchParams(window.location.search);
|
|
@@ -201,7 +209,7 @@ def get_window_url_params():
|
|
| 201 |
return url_params;
|
| 202 |
}
|
| 203 |
"""
|
| 204 |
-
|
| 205 |
## trust-game-llama-2-7b-chat
|
| 206 |
# app.py
|
| 207 |
@spaces.GPU
|
|
@@ -292,7 +300,8 @@ examples=[
|
|
| 292 |
with gr.Blocks(js=js, css="style.css") as demo:
|
| 293 |
## gradio-chatbot-read-query-param
|
| 294 |
session_index = 'eb3636167d3a63fbeee32934610e5b2f'
|
| 295 |
-
|
|
|
|
| 296 |
'''def get_session_index(url_params):
|
| 297 |
if url_params:
|
| 298 |
print(f"""
|
|
|
|
| 26 |
import os
|
| 27 |
from huggingface_hub import HfApi, HfFolder
|
| 28 |
|
| 29 |
+
'''# Define dataset repository URL and ID
|
| 30 |
DATASET_REPO_URL = "https://huggingface.co/datasets/botsi/trust-game-llama-2-7b-chat"
|
| 31 |
DATASET_REPO_ID = "botsi/trust-game-llama-2-7b-chat"
|
| 32 |
|
|
|
|
| 58 |
print(f"File ID: {file_info.id}")
|
| 59 |
else:
|
| 60 |
print("Data file does not exist.")
|
| 61 |
+
'''
|
| 62 |
|
| 63 |
MAX_MAX_NEW_TOKENS = 2048
|
| 64 |
DEFAULT_MAX_NEW_TOKENS = 1024
|
|
|
|
| 193 |
return None
|
| 194 |
|
| 195 |
|
| 196 |
+
js = """
|
| 197 |
+
function() {
|
| 198 |
+
const params = new URLSearchParams(window.location.search);
|
| 199 |
+
const url_params = Object.fromEntries(params);
|
| 200 |
+
return url_params;
|
| 201 |
+
}
|
| 202 |
+
"""
|
| 203 |
+
|
| 204 |
+
'''def get_window_url_params():
|
| 205 |
return """
|
| 206 |
function() {
|
| 207 |
const params = new URLSearchParams(window.location.search);
|
|
|
|
| 209 |
return url_params;
|
| 210 |
}
|
| 211 |
"""
|
| 212 |
+
'''
|
| 213 |
## trust-game-llama-2-7b-chat
|
| 214 |
# app.py
|
| 215 |
@spaces.GPU
|
|
|
|
| 300 |
with gr.Blocks(js=js, css="style.css") as demo:
|
| 301 |
## gradio-chatbot-read-query-param
|
| 302 |
session_index = 'eb3636167d3a63fbeee32934610e5b2f'
|
| 303 |
+
url_params = gr.JSON({}, visible=False, label="URL Params")
|
| 304 |
+
print(url_params.value)
|
| 305 |
'''def get_session_index(url_params):
|
| 306 |
if url_params:
|
| 307 |
print(f"""
|