BishalRD commited on
Commit
0c0e15d
·
1 Parent(s): 207ad9d

Simple only current message conversational chatbot

Browse files
Files changed (1) hide show
  1. app.py +26 -1
app.py CHANGED
@@ -1 +1,26 @@
1
- print("Hello, World!")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from langchain_ollama import ChatOllama
3
+ from langchain_core.messages import (
4
+ convert_to_openai_messages,
5
+ )
6
+
7
+ def chatbot(message, history):
8
+ llm = ChatOllama(model="gemma3:4b", temperature=0)
9
+ response = llm.invoke(message)
10
+ response = convert_to_openai_messages([response])
11
+ return response
12
+
13
+ demo = gr.ChatInterface(
14
+ fn=chatbot,
15
+ type = "messages",
16
+ title="Simple Chatbot",
17
+ description="Ask anything you want",
18
+ examples=["Hello", "What is your name?", "What is the weather in Tokyo?"],
19
+ )
20
+
21
+ demo.launch()
22
+
23
+
24
+
25
+
26
+