Spaces:
Runtime error
Runtime error
nos
commited on
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,5 +1,16 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
from huggingface_hub import InferenceClient
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
|
| 4 |
"""
|
| 5 |
For more information on `huggingface_hub` Inference API support, please check the docs: https://huggingface.co/docs/huggingface_hub/v0.22.2/en/guides/inference
|
|
@@ -47,6 +58,11 @@ def flip_image(x):
|
|
| 47 |
|
| 48 |
|
| 49 |
with gr.Blocks() as demo:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 50 |
with gr.Tab("Chat"):
|
| 51 |
with gr.Row():
|
| 52 |
#chatbot = gr.Chatbot()
|
|
@@ -54,15 +70,27 @@ with gr.Blocks() as demo:
|
|
| 54 |
#clear = gr.ClearButton([msg, chatbot])
|
| 55 |
|
| 56 |
#msg.submit(respond, [msg, chatbot], [msg, chatbot])
|
| 57 |
-
|
| 58 |
-
respond
|
| 59 |
-
)
|
| 60 |
with gr.Tab("ELS"):
|
| 61 |
with gr.Row():
|
| 62 |
text1 = gr.Textbox(label="Prompt to gematria conversion for apply ELS")
|
| 63 |
text2 = gr.Textbox(label="ELS value")
|
| 64 |
inbtw = gr.Button("Search")
|
| 65 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 66 |
with gr.Tab("Gematria"):
|
| 67 |
with gr.Row():
|
| 68 |
text1 = gr.Textbox(label="Text to convert")
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
from huggingface_hub import InferenceClient
|
| 3 |
+
from gematria import calculate_gematria, strip_diacritics
|
| 4 |
+
|
| 5 |
+
|
| 6 |
+
def translate_texts(start, end, step, length=0, tlang="en", spaces_include=False, strip_in_braces=True, strip_diacritics=True):
|
| 7 |
+
results = torah.process_json_files(start, end, step, length, tlang, spaces_include, strip_in_braces, strip_diacritics)
|
| 8 |
+
return results
|
| 9 |
+
|
| 10 |
+
def gematria_sum(text):
|
| 11 |
+
# Berechnet die Gematria-Summe für den eingegebenen Text
|
| 12 |
+
return calculate_gematria(strip_diacritics(text))
|
| 13 |
+
|
| 14 |
|
| 15 |
"""
|
| 16 |
For more information on `huggingface_hub` Inference API support, please check the docs: https://huggingface.co/docs/huggingface_hub/v0.22.2/en/guides/inference
|
|
|
|
| 58 |
|
| 59 |
|
| 60 |
with gr.Blocks() as demo:
|
| 61 |
+
|
| 62 |
+
gr.ChatInterface(
|
| 63 |
+
respond
|
| 64 |
+
)
|
| 65 |
+
|
| 66 |
with gr.Tab("Chat"):
|
| 67 |
with gr.Row():
|
| 68 |
#chatbot = gr.Chatbot()
|
|
|
|
| 70 |
#clear = gr.ClearButton([msg, chatbot])
|
| 71 |
|
| 72 |
#msg.submit(respond, [msg, chatbot], [msg, chatbot])
|
| 73 |
+
|
|
|
|
|
|
|
| 74 |
with gr.Tab("ELS"):
|
| 75 |
with gr.Row():
|
| 76 |
text1 = gr.Textbox(label="Prompt to gematria conversion for apply ELS")
|
| 77 |
text2 = gr.Textbox(label="ELS value")
|
| 78 |
inbtw = gr.Button("Search")
|
| 79 |
+
start = gr.Number(label="Start", value=1)
|
| 80 |
+
end = gr.Number(label="End", value=1)
|
| 81 |
+
step = gr.Number(label="Step", value=6)
|
| 82 |
+
length = gr.Number(label="Length", value=1)
|
| 83 |
+
tlang = gr.Textbox(label="Target Language", value="en")
|
| 84 |
+
spaces_include = gr.Checkbox(label="Include Spaces", value=False)
|
| 85 |
+
strip_in_braces = gr.Checkbox(label="Strip Text in Braces", value=True)
|
| 86 |
+
strip_diacritics_chk = gr.Checkbox(label="Strip Diacritics", value=True)
|
| 87 |
+
translate_btn = gr.Button("Translate")
|
| 88 |
+
translate_results = gr.JSON(label="Results")
|
| 89 |
+
translate_btn.click(
|
| 90 |
+
translate_texts,
|
| 91 |
+
inputs=[start, end, step, length, tlang, spaces_include, strip_in_braces, strip_diacritics_chk],
|
| 92 |
+
outputs=translate_results
|
| 93 |
+
)
|
| 94 |
with gr.Tab("Gematria"):
|
| 95 |
with gr.Row():
|
| 96 |
text1 = gr.Textbox(label="Text to convert")
|