Youssefk commited on
Commit
21fe8f4
1 Parent(s): 3c620ba

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -36
app.py CHANGED
@@ -1,21 +1,13 @@
1
  import streamlit as st
2
  from streamlit_chat import message
3
  import requests
4
- # from transformers import AutoModelWithLMHead, AutoTokenizer
5
-
6
- #tokenizer = AutoTokenizer.from_pretrained('microsoft/DialoGPT-small')
7
- #model = AutoModelWithLMHead.from_pretrained('output-small-save')
8
 
9
  st.set_page_config(
10
  page_title="SAI",
11
  page_icon=":robot:"
12
  )
13
 
14
- #API_URL = "https://api-inference.huggingface.co/models/microsoft/DialoGPT-small"
15
- #headers = {"Authorization": st.secrets['api_key']}
16
-
17
  st.header("Hello - Welcome to SAI")
18
- #st.markdown("[Github](https://github.com/rushic24/DialoGPT-Finetune)")
19
  st.write("""The Phantom Thief Kid sends a heist notice, warning of another heist. The police deduce that his next target is a recently discovered Fabergé egg, which Suzuki Modern Art Museum in Osaka will display on August 22. The night of the heist, Kid steals the egg and flies off, and Conan and Heiji give chase. However, in the middle of the chase, an unknown assailant shoots Kid in the right eye, and Kid apparently falls into the sea to his death. After recovering the egg, the police fruitlessly search for Kid's body.
20
 
21
  The next day, Conan, Ran, and Kogoro board a boat to Tokyo. They meet Natsumi Kousaka, whose great-grandfather worked in Fabergé's factory. She shows them a part of a sketch of two eggs and a key, which were found among her late grandmother's mementos. Conan suspects that the person who shot Kid is on the ship. That night, Ryu Sagawa, a freelance photographer covering the press with news of the egg, is murdered, shot in the right eye in the same fashion as Kid. Soon after his body is discovered, Inspector Megure, along with officers Takagi and Shiratori, arrive by helicopter to inspect the crime scene. At first, they suspect Sonoko's father's servant, Mr. Nishino, but the police and Conan conclude the culprit is Scorpion - a mysterious killer who always shoots his victims in the right eye. A missing lifeboat hints that Scorpion has escaped, and the boat's passengers go to Yokosuka Castle, which holds Scorpion's next target: the second egg.
@@ -29,43 +21,16 @@ if 'generated' not in st.session_state:
29
  if 'past' not in st.session_state:
30
  st.session_state['past'] = []
31
 
32
- # def query(payload):
33
- # bot_input_ids = tokenizer.encode(payload["inputs"]["text"] + tokenizer.eos_token, return_tensors='pt')
34
-
35
- # chat_history_ids = model.generate(
36
- # bot_input_ids, max_length=100,
37
- # pad_token_id=tokenizer.eos_token_id,
38
- # no_repeat_ngram_size=3,
39
- # do_sample=True,
40
- # top_k=10,
41
- # top_p=0.7,
42
- # temperature = 0.8
43
- # )
44
- # output = tokenizer.decode(chat_history_ids[:, bot_input_ids.shape[-1]:][0], skip_special_tokens=True)
45
- # return {"generated_text": output}
46
-
47
  def get_text():
48
  input_text = st.text_input("You: "," ", key="input")
49
  return input_text
50
 
51
 
52
-
53
- # if user_input:
54
- # output = query({
55
- # "inputs": {
56
- # "past_user_inputs": st.session_state.past,
57
- # "generated_responses": st.session_state.generated,
58
- # "text": user_input,
59
- # },"parameters": {"repetition_penalty": 1.33},
60
- # })
61
- # st.session_state.past.append(user_input)
62
- # st.session_state.generated.append(output["generated_text"])
63
-
64
  if st.session_state['generated']:
65
 
66
  for i in range(len(st.session_state['generated'])-1, -1, -1):
67
  message(st.session_state["generated"][i], key=str(i))
68
  message(st.session_state['past'][i], is_user=True, key=str(i) + '_user')
69
- # message("")
70
  message("Tell me what happened?",is_user=True)
71
  user_input = get_text()
 
1
  import streamlit as st
2
  from streamlit_chat import message
3
  import requests
 
 
 
 
4
 
5
  st.set_page_config(
6
  page_title="SAI",
7
  page_icon=":robot:"
8
  )
9
 
 
 
 
10
  st.header("Hello - Welcome to SAI")
 
11
  st.write("""The Phantom Thief Kid sends a heist notice, warning of another heist. The police deduce that his next target is a recently discovered Fabergé egg, which Suzuki Modern Art Museum in Osaka will display on August 22. The night of the heist, Kid steals the egg and flies off, and Conan and Heiji give chase. However, in the middle of the chase, an unknown assailant shoots Kid in the right eye, and Kid apparently falls into the sea to his death. After recovering the egg, the police fruitlessly search for Kid's body.
12
 
13
  The next day, Conan, Ran, and Kogoro board a boat to Tokyo. They meet Natsumi Kousaka, whose great-grandfather worked in Fabergé's factory. She shows them a part of a sketch of two eggs and a key, which were found among her late grandmother's mementos. Conan suspects that the person who shot Kid is on the ship. That night, Ryu Sagawa, a freelance photographer covering the press with news of the egg, is murdered, shot in the right eye in the same fashion as Kid. Soon after his body is discovered, Inspector Megure, along with officers Takagi and Shiratori, arrive by helicopter to inspect the crime scene. At first, they suspect Sonoko's father's servant, Mr. Nishino, but the police and Conan conclude the culprit is Scorpion - a mysterious killer who always shoots his victims in the right eye. A missing lifeboat hints that Scorpion has escaped, and the boat's passengers go to Yokosuka Castle, which holds Scorpion's next target: the second egg.
 
21
  if 'past' not in st.session_state:
22
  st.session_state['past'] = []
23
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24
  def get_text():
25
  input_text = st.text_input("You: "," ", key="input")
26
  return input_text
27
 
28
 
 
 
 
 
 
 
 
 
 
 
 
 
29
  if st.session_state['generated']:
30
 
31
  for i in range(len(st.session_state['generated'])-1, -1, -1):
32
  message(st.session_state["generated"][i], key=str(i))
33
  message(st.session_state['past'][i], is_user=True, key=str(i) + '_user')
34
+
35
  message("Tell me what happened?",is_user=True)
36
  user_input = get_text()