namantjeaswi commited on
Commit
73e1ba2
·
1 Parent(s): ac80048

update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -6
app.py CHANGED
@@ -24,18 +24,17 @@ model_id = "mistralai/Mistral-7B-v0.1"
24
 
25
 
26
 
27
- #tokenizer = AutoTokenizer.from_pretrained(model_id)
28
- #model = AutoModelForCausalLM.from_pretrained(model_id)
29
 
30
  # Create text generation pipeline
31
- #pipe = pipeline(model = model, tokenizer = tokenizer)
32
 
33
 
34
  with st.form('my_form'):
35
  question = st.text_area('Enter your question:', 'Tell me about attention mechanisms in a transformer?')
36
  submitted = st.form_submit_button('Submit')
37
  if submitted:
38
- #result = pipe(question, max_length=100)
39
  st.write(question)
40
- #st.write(result[0]['generated_text'])
41
- st.write(pipeline('text-generation', model=model_id)(question, max_length=100)[0]['generated_text'])
 
24
 
25
 
26
 
27
+ tokenizer = AutoTokenizer.from_pretrained(model_id)
28
+ model = AutoModelForCausalLM.from_pretrained(model_id)
29
 
30
  # Create text generation pipeline
31
+ pipe = pipeline(model = model, tokenizer = tokenizer)
32
 
33
 
34
  with st.form('my_form'):
35
  question = st.text_area('Enter your question:', 'Tell me about attention mechanisms in a transformer?')
36
  submitted = st.form_submit_button('Submit')
37
  if submitted:
38
+ result = pipe(question, max_length=100)
39
  st.write(question)
40
+ st.write(result[0]['generated_text'])