Update app.py
Browse files
app.py
CHANGED
|
@@ -1,12 +1,12 @@
|
|
| 1 |
import os
|
| 2 |
import gradio as gr
|
| 3 |
-
|
| 4 |
|
| 5 |
API_KEY = os.environ.get("DEEPSEA_API_KEY")
|
| 6 |
if not API_KEY:
|
| 7 |
raise ValueError("الرجاء وضع DEEPSEA_API_KEY في البيئة (Secrets على Hugging Face)")
|
| 8 |
|
| 9 |
-
client =
|
| 10 |
MODEL_NAME = "text-generator-arabic"
|
| 11 |
|
| 12 |
def generate_main_question_deepsea(paragraph: str):
|
|
@@ -28,7 +28,6 @@ def generate_main_question_deepsea(paragraph: str):
|
|
| 28 |
except Exception as e:
|
| 29 |
return f"Error while connecting to DeepSea API: {e}"
|
| 30 |
|
| 31 |
-
# واجهة Gradio
|
| 32 |
with gr.Blocks() as demo:
|
| 33 |
gr.Markdown("## MainQuestion — Basic Question Generator (Arabic Output)")
|
| 34 |
|
|
|
|
| 1 |
import os
|
| 2 |
import gradio as gr
|
| 3 |
+
import deepsea
|
| 4 |
|
| 5 |
API_KEY = os.environ.get("DEEPSEA_API_KEY")
|
| 6 |
if not API_KEY:
|
| 7 |
raise ValueError("الرجاء وضع DEEPSEA_API_KEY في البيئة (Secrets على Hugging Face)")
|
| 8 |
|
| 9 |
+
client = deepsea.Client(api_key=API_KEY)
|
| 10 |
MODEL_NAME = "text-generator-arabic"
|
| 11 |
|
| 12 |
def generate_main_question_deepsea(paragraph: str):
|
|
|
|
| 28 |
except Exception as e:
|
| 29 |
return f"Error while connecting to DeepSea API: {e}"
|
| 30 |
|
|
|
|
| 31 |
with gr.Blocks() as demo:
|
| 32 |
gr.Markdown("## MainQuestion — Basic Question Generator (Arabic Output)")
|
| 33 |
|