Spaces:
Sleeping
Sleeping
avigdoridori
commited on
Commit
•
7f14422
1
Parent(s):
f0484d5
Upload app.py
Browse files
app.py
ADDED
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
|
3 |
+
from langchain_community.llms import Ollama
|
4 |
+
|
5 |
+
llm = Ollama(base_url='http://127.0.0.1:11434', model="mistral")
|
6 |
+
|
7 |
+
def generate_output():
|
8 |
+
return llm.invoke("Generate 5 exciting AI web projects")
|
9 |
+
|
10 |
+
iface = gr.Interface(
|
11 |
+
fn=generate_output,
|
12 |
+
inputs=None,
|
13 |
+
outputs=gr.Textbox(label="Ollama Output"),
|
14 |
+
title="Ollama AI Assistant",
|
15 |
+
description="5 exciting web ideas",
|
16 |
+
theme=gr.themes.Soft(
|
17 |
+
primary_hue="indigo",
|
18 |
+
secondary_hue="blue",
|
19 |
+
),
|
20 |
+
css="""
|
21 |
+
.container {max-width: 800px; margin: auto;}
|
22 |
+
#output-box {
|
23 |
+
border: 2px solid #4b0082;
|
24 |
+
border-radius: 10px;
|
25 |
+
padding: 20px;
|
26 |
+
background-color: #f0f8ff;
|
27 |
+
box-shadow: 0 4px 8px rgba(0,0,0,0.1);
|
28 |
+
}
|
29 |
+
.generate-button {
|
30 |
+
background-color: #4b0082 !important;
|
31 |
+
color: white !important;
|
32 |
+
font-weight: bold !important;
|
33 |
+
padding: 10px 20px !important;
|
34 |
+
border-radius: 5px !important;
|
35 |
+
transition: all 0.3s ease !important;
|
36 |
+
}
|
37 |
+
.generate-button:hover {
|
38 |
+
background-color: #3a006f !important;
|
39 |
+
transform: translateY(-2px) !important;
|
40 |
+
}
|
41 |
+
"""
|
42 |
+
)
|
43 |
+
|
44 |
+
iface.launch()
|