Group2255 commited on
Commit
d5cf00e
Β·
verified Β·
1 Parent(s): 9ebada2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -1,5 +1,5 @@
1
  # app.py
2
- # PromptPilot: Unified AI Chatbot with 5 Lightweight Modes (AML-3304 Assignment)
3
 
4
  import streamlit as st
5
  from transformers import AutoTokenizer, AutoModelForCausalLM, AutoModelForSeq2SeqLM
@@ -25,8 +25,8 @@ with cols[2]:
25
  if st.button("πŸ“Š Bayesian Q&A"):
26
  st.session_state.mode = 'Bayesian Q&A'
27
  with cols[3]:
28
- if st.button("🌐 Lightweight Coder"):
29
- st.session_state.mode = 'Lightweight Coder'
30
  with cols[4]:
31
  if st.button("πŸ” Transformer Explorer"):
32
  st.session_state.mode = 'Transformer Explorer'
@@ -76,12 +76,12 @@ if user_input and st.session_state.mode:
76
  st.subheader("πŸ“Š Bayesian-style Answer:")
77
  st.write(result)
78
 
79
- elif st.session_state.mode == 'Lightweight Coder':
80
  tokenizer, model = load_codegen()
81
  inputs = tokenizer(user_input, return_tensors="pt")
82
  outputs = model.generate(inputs["input_ids"], max_new_tokens=128, do_sample=True, temperature=0.8)
83
  result = tokenizer.decode(outputs[0], skip_special_tokens=True)
84
- st.subheader("🌐 Lightweight Code:")
85
  st.code(result, language="python")
86
 
87
  elif st.session_state.mode == 'Transformer Explorer':
@@ -90,5 +90,5 @@ if user_input and st.session_state.mode:
90
  inputs = tokenizer(prompt, return_tensors="pt")
91
  outputs = model.generate(**inputs, max_new_tokens=100)
92
  result = tokenizer.decode(outputs[0], skip_special_tokens=True)
93
- st.subheader("πŸ” Paraphrased by Transformer:")
94
  st.write(result)
 
1
  # app.py
2
+ # PromptPilot: Unified AI Chatbot with 5 Modes (AML-3304 Assignment)
3
 
4
  import streamlit as st
5
  from transformers import AutoTokenizer, AutoModelForCausalLM, AutoModelForSeq2SeqLM
 
25
  if st.button("πŸ“Š Bayesian Q&A"):
26
  st.session_state.mode = 'Bayesian Q&A'
27
  with cols[3]:
28
+ if st.button("🌐 Deep Coder"):
29
+ st.session_state.mode = 'Deep Coder'
30
  with cols[4]:
31
  if st.button("πŸ” Transformer Explorer"):
32
  st.session_state.mode = 'Transformer Explorer'
 
76
  st.subheader("πŸ“Š Bayesian-style Answer:")
77
  st.write(result)
78
 
79
+ elif st.session_state.mode == 'Deep Coder':
80
  tokenizer, model = load_codegen()
81
  inputs = tokenizer(user_input, return_tensors="pt")
82
  outputs = model.generate(inputs["input_ids"], max_new_tokens=128, do_sample=True, temperature=0.8)
83
  result = tokenizer.decode(outputs[0], skip_special_tokens=True)
84
+ st.subheader("🌐 Code Output:")
85
  st.code(result, language="python")
86
 
87
  elif st.session_state.mode == 'Transformer Explorer':
 
90
  inputs = tokenizer(prompt, return_tensors="pt")
91
  outputs = model.generate(**inputs, max_new_tokens=100)
92
  result = tokenizer.decode(outputs[0], skip_special_tokens=True)
93
+ st.subheader("πŸ” Paraphrased Text:")
94
  st.write(result)