Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from langchain.llms import Ollama
|
3 |
+
|
4 |
+
llm = Ollama(model="deepseek-r1:1.5b")
|
5 |
+
|
6 |
+
def query_model(prompt: str) -> str:
|
7 |
+
"""
|
8 |
+
Uses LangChain's Ollama integration to process the input prompt.
|
9 |
+
"""
|
10 |
+
response = llm(prompt)
|
11 |
+
return response
|
12 |
+
|
13 |
+
iface = gr.Interface(
|
14 |
+
fn=query_model,
|
15 |
+
inputs="text",
|
16 |
+
outputs="text",
|
17 |
+
title="Ollama via LangChain & Gradio",
|
18 |
+
description="Enter a prompt to interact with the Ollama-based model."
|
19 |
+
)
|
20 |
+
|
21 |
+
if __name__ == "__main__":
|
22 |
+
iface.launch(server_name="0.0.0.0", server_port=8080)
|