Nikola299 commited on
Commit
0bb956f
1 Parent(s): 6cc8dbd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -33
app.py CHANGED
@@ -1,40 +1,9 @@
1
  import streamlit as st
2
- import torch
3
- from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
4
 
5
  st.write("runningg")
6
 
7
-
8
- torch.random.manual_seed(0)
9
- model = AutoModelForCausalLM.from_pretrained("microsoft/Phi-3-mini-4k-instruct",trust_remote_code=True)
10
- tokenizer = AutoTokenizer.from_pretrained("microsoft/Phi-3-mini-4k-instruct")
11
-
12
  text = st.text_area("Enter text....")
13
- messages = [
14
- {"role": "system", "content": "You are a helpful AI assistant."},
15
- {"role": "user", "content": "Can you provide ways to eat combinations of bananas and dragonfruits?"},
16
- {"role": "assistant", "content": "Sure! Here are some ways to eat bananas and dragonfruits together: 1. Banana and dragonfruit smoothie: Blend bananas and dragonfruits together with some milk and honey. 2. Banana and dragonfruit salad: Mix sliced bananas and dragonfruits together with some lemon juice and honey."},
17
- {"role": "user", "content": "What about solving an 2x + 3 = 7 equation?"},
18
- ]
19
-
20
-
21
- pipe = pipeline(
22
- "text-generation",
23
- model=model,
24
- tokenizer=tokenizer,
25
- )
26
-
27
- generation_args = {
28
- "max_new_tokens": 500,
29
- "return_full_text": False,
30
- "temperature": 0.0,
31
- "do_sample": False,
32
- }
33
-
34
-
35
 
36
 
37
- if text:
38
- st.write("calculating")
39
- out = pipe(messages, **generation_args)
40
- st.write(out)
 
1
  import streamlit as st
 
 
2
 
3
  st.write("runningg")
4
 
 
 
 
 
 
5
  text = st.text_area("Enter text....")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
 
7
 
8
+ if st.button("Analyse"):
9
+ print(text)