Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -2,13 +2,10 @@ import gradio as gr
|
|
2 |
from gradio_client import Client
|
3 |
from huggingface_hub import InferenceClient
|
4 |
import random
|
5 |
-
|
6 |
|
7 |
models=[
|
8 |
-
"google/gemma-7b"
|
9 |
-
"google/gemma-7b-it",
|
10 |
-
"google/gemma-2b",
|
11 |
-
"google/gemma-2b-it"
|
12 |
]
|
13 |
clients=[
|
14 |
InferenceClient(models[0]),
|
@@ -91,16 +88,6 @@ def chat_inf(system_prompt,prompt,history,memory,client_choice,seed,temp,tokens,
|
|
91 |
print("\n######### HIST "+str(in_len))
|
92 |
print("\n######### TOKENS "+str(tokens))
|
93 |
|
94 |
-
def get_screenshot(chat: list,height=5000,width=600,chatblock=[],theme="light",wait=3000,header=True):
|
95 |
-
print(chatblock)
|
96 |
-
tog = 0
|
97 |
-
if chatblock:
|
98 |
-
tog = 3
|
99 |
-
result = ss_client.predict(str(chat),height,width,chatblock,header,theme,wait,api_name="/run_script")
|
100 |
-
out = f'https://omnibus-html-image-current-tab.hf.space/file={result[tog]}'
|
101 |
-
print(out)
|
102 |
-
return out
|
103 |
-
|
104 |
def clear_fn():
|
105 |
return None,None,None,None
|
106 |
rand_val=random.randint(1,1111111111111111)
|
@@ -156,7 +143,6 @@ with gr.Blocks() as app:
|
|
156 |
client_choice.change(load_models,client_choice,[chat_b])
|
157 |
app.load(load_models,client_choice,[chat_b])
|
158 |
|
159 |
-
im_go=im_btn.click(get_screenshot,[chat_b,im_height,im_width,chatblock,theme,wait_time],img)
|
160 |
|
161 |
chat_sub=inp.submit(check_rand,[rand,seed],seed).then(chat_inf,[sys_inp,inp,chat_b,memory,client_choice,seed,temp,tokens,top_p,rep_p,chat_mem,custom_prompt],[chat_b,memory])
|
162 |
go=btn.click(check_rand,[rand,seed],seed).then(chat_inf,[sys_inp,inp,chat_b,memory,client_choice,seed,temp,tokens,top_p,rep_p,chat_mem,custom_prompt],[chat_b,memory])
|
|
|
2 |
from gradio_client import Client
|
3 |
from huggingface_hub import InferenceClient
|
4 |
import random
|
5 |
+
from deep_translator import GoogleTranslator
|
6 |
|
7 |
models=[
|
8 |
+
"google/gemma-7b"
|
|
|
|
|
|
|
9 |
]
|
10 |
clients=[
|
11 |
InferenceClient(models[0]),
|
|
|
88 |
print("\n######### HIST "+str(in_len))
|
89 |
print("\n######### TOKENS "+str(tokens))
|
90 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
91 |
def clear_fn():
|
92 |
return None,None,None,None
|
93 |
rand_val=random.randint(1,1111111111111111)
|
|
|
143 |
client_choice.change(load_models,client_choice,[chat_b])
|
144 |
app.load(load_models,client_choice,[chat_b])
|
145 |
|
|
|
146 |
|
147 |
chat_sub=inp.submit(check_rand,[rand,seed],seed).then(chat_inf,[sys_inp,inp,chat_b,memory,client_choice,seed,temp,tokens,top_p,rep_p,chat_mem,custom_prompt],[chat_b,memory])
|
148 |
go=btn.click(check_rand,[rand,seed],seed).then(chat_inf,[sys_inp,inp,chat_b,memory,client_choice,seed,temp,tokens,top_p,rep_p,chat_mem,custom_prompt],[chat_b,memory])
|