Alhdrawi commited on
Commit
1032a08
·
verified ·
1 Parent(s): 4a697a1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -3
app.py CHANGED
@@ -2,10 +2,8 @@ import os
2
  import gradio as gr
3
  from openai import OpenAI
4
 
5
- # ضع توكن Hugging Face هنا أو خزنه في متغير بيئة
6
  HF_TOKEN = os.environ.get("HF_TOKEN", "ضع_التوكن_هنا")
7
 
8
- # إنشاء عميل OpenAI موجه لـ Hugging Face Inference API
9
  client = OpenAI(
10
  base_url="https://router.huggingface.co/v1",
11
  api_key=HF_TOKEN
@@ -20,7 +18,7 @@ def chat_with_model(user_message):
20
  ],
21
  max_tokens=200
22
  )
23
- return completion.choices[0].message["content"]
24
  except Exception as e:
25
  return f"Error: {e}"
26
 
 
2
  import gradio as gr
3
  from openai import OpenAI
4
 
 
5
  HF_TOKEN = os.environ.get("HF_TOKEN", "ضع_التوكن_هنا")
6
 
 
7
  client = OpenAI(
8
  base_url="https://router.huggingface.co/v1",
9
  api_key=HF_TOKEN
 
18
  ],
19
  max_tokens=200
20
  )
21
+ return completion.choices[0].message.content
22
  except Exception as e:
23
  return f"Error: {e}"
24