willco-afk commited on
Commit
2e3e167
·
verified ·
1 Parent(s): 6728108

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -12
app.py CHANGED
@@ -1,17 +1,17 @@
 
1
  from transformers import pipeline
2
 
3
- # Initialize a Zero-Shot reasoning model (T5)
4
- t5_model = pipeline("text2text-generation", model="t5-large")
5
 
6
- # Initialize GPT-2 for text generation (CoT reasoning alternative)
7
- gpt_model = pipeline("text-generation", model="gpt2") # You can replace "gpt2" with another available model like "EleutherAI/gpt-neo-2.7B"
 
8
 
9
- # Simple example of Zero-Shot reasoning with T5
10
- input_text = "Can you explain why the sky is blue using reasoning?"
11
- t5_output = t5_model(input_text, max_length=100)
12
- print("T5 Model Output:", t5_output)
13
 
14
- # Example of text generation with GPT-2 (CoT reasoning alternative)
15
- cot_input = "Explain why the sky is blue step by step."
16
- gpt_output = gpt_model(cot_input, max_length=150)
17
- print("GPT-2 Output:", gpt_output)
 
1
+ import streamlit as st
2
  from transformers import pipeline
3
 
4
+ # Load Zero-Shot Classification Model
5
+ zero_shot_classifier = pipeline("zero-shot-classification", model="facebook/bart-large-mnli")
6
 
7
+ # Input from the user
8
+ st.title("Zero-Shot Classification")
9
+ text_input = st.text_area("Enter text to classify:", "")
10
 
11
+ # Define possible candidate labels
12
+ candidate_labels = ["reasoning", "logic", "problem-solving", "explanation"]
 
 
13
 
14
+ # Run the zero-shot model
15
+ if text_input:
16
+ result = zero_shot_classifier(text_input, candidate_labels)
17
+ st.write(result)