demetz commited on
Commit
0177524
·
verified ·
1 Parent(s): d4db6df

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -10
app.py CHANGED
@@ -20,7 +20,7 @@ def get_top_chunks(query):
20
 
21
  client = InferenceClient("mistralai/Mistral-7B-Instruct-v0.2")
22
 
23
- def respond(message, history, name, char_class, char_alignment, char_race):
24
  response = ""
25
  top_chunks = get_top_chunks(message)
26
  context = "\n".join(top_chunks)
@@ -30,9 +30,9 @@ def respond(message, history, name, char_class, char_alignment, char_race):
30
  "role": "system",
31
  "content": (
32
  "You are Gorf, a 25 year old female druid who knows Wild Shape, but only ever learned how to become a Frog. You mention that sometimes. Your life passion is to help people find the perfect person to join their party, by helping the user create the perfect character to help their party. You are very kind and helpful."
33
- f"The user might provide the following information, please use the context of their inputs in your response: \n Character name: {name}, Character Class: {char_class}, Character Race: {char_race}, Character Alignment: {char_alignment}. If they don't include all the information, try to fill in these details with traits that best fit the needs of the party."
34
  f"Use the following knowledge to inform your answers:\n\n{context}\n\n"
35
- "Reply with a short paragraph about how the character is introduced to the rest of the party, then catagory:paragraph \n catagory: paragraph format for each section: Character Backstory, Personality Traits, Ideals, Flaws, Features and Traits, Other Proficiencies and Languages, Treasure"
36
  )
37
  }
38
  ]
@@ -105,13 +105,10 @@ with gr.Blocks(theme=theme) as chatbot:
105
  campaign_description = gr.Textbox(label="Describe the campaign and the current situation", lines=5)
106
  party_description = gr.Textbox(label="Describe the current members of your party", lines=5)
107
 
108
-
109
-
110
  with gr.Column(scale=2):
111
  with gr.Column(scale=2):
112
- chat = gr.ChatInterface(
113
- fn=respond,
114
- type="messages",
115
- additional_inputs=[character_name, character_class, character_race, character_alignment]) # Pass name into function!
116
- chat.chatbot.value = [["", "Hi! I'm Gorf, your helpful frog druid 🐸. Let's make you the perfect new party member!"]]
117
  chatbot.launch()
 
20
 
21
  client = InferenceClient("mistralai/Mistral-7B-Instruct-v0.2")
22
 
23
+ def respond(message, history, name, char_class, char_alignment, char_race, campaign, party):
24
  response = ""
25
  top_chunks = get_top_chunks(message)
26
  context = "\n".join(top_chunks)
 
30
  "role": "system",
31
  "content": (
32
  "You are Gorf, a 25 year old female druid who knows Wild Shape, but only ever learned how to become a Frog. You mention that sometimes. Your life passion is to help people find the perfect person to join their party, by helping the user create the perfect character to help their party. You are very kind and helpful."
33
+ f"The user might provide the following information, please use the context of their inputs in your response: \n Character name: {name}, Character Class: {char_class}, Character Race: {char_race}, Character Alignment: {char_alignment}, a description of the other characters in their party: {party} and the plot of their campaign with their current situation: {campaign}. If they don't include all the information, try to fill in these details with traits that best fit the needs of the party."
34
  f"Use the following knowledge to inform your answers:\n\n{context}\n\n"
35
+ "Reply with 2 or 3 sentences about how the character is introduced to the rest of the party, then catagory:paragraph \n catagory: paragraph format for each section: Character Backstory, Personality Traits, Ideals, Flaws, Features and Traits, Other Proficiencies and Languages, Treasure"
36
  )
37
  }
38
  ]
 
105
  campaign_description = gr.Textbox(label="Describe the campaign and the current situation", lines=5)
106
  party_description = gr.Textbox(label="Describe the current members of your party", lines=5)
107
 
 
 
108
  with gr.Column(scale=2):
109
  with gr.Column(scale=2):
110
+ gr.ChatInterface(
111
+ fn=respond,
112
+ type="messages",
113
+ additional_inputs=[character_name, character_class, character_race, character_alignment, campaign_description, party_description]) # Pass name into function!
 
114
  chatbot.launch()