willco-afk commited on
Commit
2654826
·
verified ·
1 Parent(s): 9fa3a55

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -0
app.py ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ from transformers import pipeline
3
+
4
+ # Load the CoT model (You can use a different model for CoT reasoning if needed)
5
+ cot_model = pipeline("text-generation", model="gpt-2")
6
+
7
+ # Title for the app
8
+ st.title("Chain-of-Thought (CoT) Reasoning")
9
+
10
+ # Input field for the question
11
+ question_input = st.text_area("Enter a question for Chain-of-Thought reasoning:")
12
+
13
+ # If the user has entered a question
14
+ if question_input:
15
+ # Generate the CoT output
16
+ response = cot_model(f"Let's think step by step: {question_input}", max_length=200, num_return_sequences=1)
17
+
18
+ # Display the result
19
+ st.write("Chain-of-Thought Reasoning Result:")
20
+ st.write(response[0]['generated_text'])