File size: 697 Bytes
2654826
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import streamlit as st
from transformers import pipeline

# Load the CoT model (You can use a different model for CoT reasoning if needed)
cot_model = pipeline("text-generation", model="gpt-2")

# Title for the app
st.title("Chain-of-Thought (CoT) Reasoning")

# Input field for the question
question_input = st.text_area("Enter a question for Chain-of-Thought reasoning:")

# If the user has entered a question
if question_input:
    # Generate the CoT output
    response = cot_model(f"Let's think step by step: {question_input}", max_length=200, num_return_sequences=1)
    
    # Display the result
    st.write("Chain-of-Thought Reasoning Result:")
    st.write(response[0]['generated_text'])