Arabic250 commited on
Commit
74f3f38
·
verified ·
1 Parent(s): d789c8a

Upload folder using huggingface_hub

Browse files
Files changed (2) hide show
  1. Dockerfile +18 -0
  2. app.py +14 -0
Dockerfile ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ FROM python:3.10
3
+
4
+ # تثبيت Ollama
5
+ RUN curl -fsSL https://ollama.com/install.sh | sh
6
+
7
+ # تثبيت المكتبات المطلوبة
8
+ RUN pip install gradio ollama pypdf
9
+
10
+ # إعداد بيئة العمل
11
+ WORKDIR /code
12
+ COPY . .
13
+
14
+ # صلاحيات المستخدم
15
+ RUN chmod -R 777 /code
16
+
17
+ # تشغيل الخادم والواجهة
18
+ CMD ollama serve & sleep 5 && ollama pull gemma4:e2b && python app.py
app.py ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import gradio as gr
3
+ import ollama
4
+ import os
5
+
6
+ def chat(message, history):
7
+ stream = ollama.chat(model='gemma4:e2b', messages=[{'role': 'user', 'content': message}], stream=True)
8
+ reply = ""
9
+ for chunk in stream:
10
+ reply += chunk['message']['content']
11
+ yield reply
12
+
13
+ demo = gr.ChatInterface(fn=chat, title="BrainMap OS on Space")
14
+ demo.launch(server_name="0.0.0.0", server_port=7860)