mkoot007 commited on
Commit
8a6183c
1 Parent(s): 590a448

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -7
app.py CHANGED
@@ -1,11 +1,24 @@
1
- from transformers import AutoTokenizer, AutoModelForTokenClassification
2
  from transformers import pipeline
3
 
4
- tokenizer = AutoTokenizer.from_pretrained("dslim/bert-base-NER")
5
- model = AutoModelForTokenClassification.from_pretrained("dslim/bert-base-NER")
6
 
7
- nlp = pipeline("ner", model=model, tokenizer=tokenizer)
8
- example = "My name is Wolfgang and I live in Berlin"
 
 
 
9
 
10
- ner_results = nlp(example)
11
- print(ner_results)
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
  from transformers import pipeline
3
 
4
+ # Load conversational pipeline
5
+ chat_pipe = pipeline("conversational", model="alpindale/goliath-120b")
6
 
7
+ # Define a function to generate responses
8
+ def generate_response(user_input):
9
+ # Generate response from the chat pipeline
10
+ response = chat_pipe(user_input)[0]['generated_responses'][0]
11
+ return response
12
 
13
+ # Create Gradio Interface
14
+ iface = gr.Interface(
15
+ fn=generate_response,
16
+ inputs=gr.Textbox(),
17
+ outputs=gr.Textbox(),
18
+ live=True,
19
+ title="Conversational Chat",
20
+ description="Chat with the AI model using Gradio!"
21
+ )
22
+
23
+ # Launch the Gradio interface
24
+ iface.launch()