milwright commited on
Commit
a3521c7
·
verified ·
1 Parent(s): c99b6f3

Upload 4 files

Browse files
Files changed (4) hide show
  1. README.md +2 -2
  2. app.py +14 -7
  3. config.json +5 -3
  4. requirements.txt +1 -1
README.md CHANGED
@@ -4,7 +4,7 @@ emoji: 💬
4
  colorFrom: blue
5
  colorTo: green
6
  sdk: gradio
7
- sdk_version: 5.39.0
8
  app_file: app.py
9
  pinned: false
10
  license: mit
@@ -42,7 +42,7 @@ AI Italian conversation partner
42
  Your Space should now be running! Try the example prompts or ask your own questions.
43
 
44
  ## Configuration
45
- - **Model**: openai/gpt-oss-120b
46
  - **API Key Variable**: API_KEY
47
  - **HF Token Variable**: HF_TOKEN (for auto-updates)
48
  - **Access Control**: Enabled (ACCESS_CODE)
 
4
  colorFrom: blue
5
  colorTo: green
6
  sdk: gradio
7
+ sdk_version: 5.42.0
8
  app_file: app.py
9
  pinned: false
10
  license: mit
 
42
  Your Space should now be running! Try the example prompts or ask your own questions.
43
 
44
  ## Configuration
45
+ - **Model**: google/gemma-3-27b-it
46
  - **API Key Variable**: API_KEY
47
  - **HF Token Variable**: HF_TOKEN (for auto-updates)
48
  - **Access Control**: Enabled (ACCESS_CODE)
app.py CHANGED
@@ -22,10 +22,10 @@ DEFAULT_CONFIG = {
22
  'system_prompt': "You are Domenico from Sicily, a Juventus football fan, native Italian speaker serving as a conversational partner for university students in an Italian 101 class. Students will interact and converse with you in Italian, and you must respond EXCLUSIVELY IN ITALIAN without providing English translations, using vocabulary appropriate for beginner-level Italian 101 students. Focus your responses on topics suitable for beginners such as sports, daily life, routines, food, numbers, and hobbies. When students make errors, model the correct forms naturally in your response without explicitly pointing out mistakes, allowing them to learn through exposure to proper usage. Recognize when students demonstrate more advanced abilities and adjust your language complexity accordingly, while ensuring your Italian remains error-free. Keep all responses between 5-50 words, making sure sentences are grammatically complete. Limit all verb conjugations to the present tense only, avoiding all other verb forms and tenses. Address students using the informal second-person singular 'tu' form.",
23
  'temperature': 0.5,
24
  'max_tokens': 250,
25
- 'model': 'openai/gpt-oss-120b',
26
  'api_key_var': 'API_KEY',
27
- 'theme': 'Base',
28
- 'grounding_urls': [],
29
  'enable_dynamic_urls': True,
30
  'enable_file_upload': True,
31
  'examples': ['Ciao! Come stai oggi?', 'Mi piace giocare a calcio. E tu?', 'Cosa mangi di solito a colazione?', 'A che ora ti svegli la mattina?', 'Qual è il tuo sport preferito?'],
@@ -591,11 +591,11 @@ def create_interface():
591
  )
592
 
593
  # Export handler
594
- def prepare_export():
595
- if not chat_history_store:
596
  return None
597
 
598
- content = export_conversation_to_markdown(chat_history_store)
599
 
600
  # Create filename
601
  space_name_safe = re.sub(r'[^a-zA-Z0-9]+', '_', SPACE_NAME).lower()
@@ -610,6 +610,7 @@ def create_interface():
610
 
611
  export_btn.click(
612
  prepare_export,
 
613
  outputs=[export_btn]
614
  )
615
 
@@ -649,7 +650,13 @@ def create_interface():
649
  # Wire up the interface
650
  msg.submit(respond, [msg, chatbot, uploaded_files, access_granted], [chatbot, msg, access_granted])
651
  submit_btn.click(respond, [msg, chatbot, uploaded_files, access_granted], [chatbot, msg, access_granted])
652
- clear_btn.click(lambda: ([], ""), outputs=[chatbot, msg])
 
 
 
 
 
 
653
 
654
  # File upload accordion
655
  if ENABLE_FILE_UPLOAD:
 
22
  'system_prompt': "You are Domenico from Sicily, a Juventus football fan, native Italian speaker serving as a conversational partner for university students in an Italian 101 class. Students will interact and converse with you in Italian, and you must respond EXCLUSIVELY IN ITALIAN without providing English translations, using vocabulary appropriate for beginner-level Italian 101 students. Focus your responses on topics suitable for beginners such as sports, daily life, routines, food, numbers, and hobbies. When students make errors, model the correct forms naturally in your response without explicitly pointing out mistakes, allowing them to learn through exposure to proper usage. Recognize when students demonstrate more advanced abilities and adjust your language complexity accordingly, while ensuring your Italian remains error-free. Keep all responses between 5-50 words, making sure sentences are grammatically complete. Limit all verb conjugations to the present tense only, avoiding all other verb forms and tenses. Address students using the informal second-person singular 'tu' form.",
23
  'temperature': 0.5,
24
  'max_tokens': 250,
25
+ 'model': 'google/gemma-3-27b-it',
26
  'api_key_var': 'API_KEY',
27
+ 'theme': 'Default',
28
+ 'grounding_urls': ["https://www.pnac.org/wp-content/uploads/Italian-Study-Guide.pdf"],
29
  'enable_dynamic_urls': True,
30
  'enable_file_upload': True,
31
  'examples': ['Ciao! Come stai oggi?', 'Mi piace giocare a calcio. E tu?', 'Cosa mangi di solito a colazione?', 'A che ora ti svegli la mattina?', 'Qual è il tuo sport preferito?'],
 
591
  )
592
 
593
  # Export handler
594
+ def prepare_export(chat_history):
595
+ if not chat_history:
596
  return None
597
 
598
+ content = export_conversation_to_markdown(chat_history)
599
 
600
  # Create filename
601
  space_name_safe = re.sub(r'[^a-zA-Z0-9]+', '_', SPACE_NAME).lower()
 
610
 
611
  export_btn.click(
612
  prepare_export,
613
+ inputs=[chatbot],
614
  outputs=[export_btn]
615
  )
616
 
 
650
  # Wire up the interface
651
  msg.submit(respond, [msg, chatbot, uploaded_files, access_granted], [chatbot, msg, access_granted])
652
  submit_btn.click(respond, [msg, chatbot, uploaded_files, access_granted], [chatbot, msg, access_granted])
653
+
654
+ def clear_chat():
655
+ global chat_history_store
656
+ chat_history_store = []
657
+ return [], ""
658
+
659
+ clear_btn.click(clear_chat, outputs=[chatbot, msg])
660
 
661
  # File upload accordion
662
  if ENABLE_FILE_UPLOAD:
config.json CHANGED
@@ -3,7 +3,7 @@
3
  "tagline": "AI Italian conversation partner",
4
  "description": "AI Italian conversation partner",
5
  "system_prompt": "You are Domenico from Sicily, a Juventus football fan, native Italian speaker serving as a conversational partner for university students in an Italian 101 class. Students will interact and converse with you in Italian, and you must respond EXCLUSIVELY IN ITALIAN without providing English translations, using vocabulary appropriate for beginner-level Italian 101 students. Focus your responses on topics suitable for beginners such as sports, daily life, routines, food, numbers, and hobbies. When students make errors, model the correct forms naturally in your response without explicitly pointing out mistakes, allowing them to learn through exposure to proper usage. Recognize when students demonstrate more advanced abilities and adjust your language complexity accordingly, while ensuring your Italian remains error-free. Keep all responses between 5-50 words, making sure sentences are grammatically complete. Limit all verb conjugations to the present tense only, avoiding all other verb forms and tenses. Address students using the informal second-person singular 'tu' form.",
6
- "model": "openai/gpt-oss-120b",
7
  "language": "Italian",
8
  "api_key_var": "API_KEY",
9
  "temperature": 0.5,
@@ -15,8 +15,10 @@
15
  "A che ora ti svegli la mattina?",
16
  "Qual \u00e8 il tuo sport preferito?"
17
  ],
18
- "grounding_urls": [],
 
 
19
  "enable_dynamic_urls": true,
20
  "enable_file_upload": true,
21
- "theme": "Base"
22
  }
 
3
  "tagline": "AI Italian conversation partner",
4
  "description": "AI Italian conversation partner",
5
  "system_prompt": "You are Domenico from Sicily, a Juventus football fan, native Italian speaker serving as a conversational partner for university students in an Italian 101 class. Students will interact and converse with you in Italian, and you must respond EXCLUSIVELY IN ITALIAN without providing English translations, using vocabulary appropriate for beginner-level Italian 101 students. Focus your responses on topics suitable for beginners such as sports, daily life, routines, food, numbers, and hobbies. When students make errors, model the correct forms naturally in your response without explicitly pointing out mistakes, allowing them to learn through exposure to proper usage. Recognize when students demonstrate more advanced abilities and adjust your language complexity accordingly, while ensuring your Italian remains error-free. Keep all responses between 5-50 words, making sure sentences are grammatically complete. Limit all verb conjugations to the present tense only, avoiding all other verb forms and tenses. Address students using the informal second-person singular 'tu' form.",
6
+ "model": "google/gemma-3-27b-it",
7
  "language": "Italian",
8
  "api_key_var": "API_KEY",
9
  "temperature": 0.5,
 
15
  "A che ora ti svegli la mattina?",
16
  "Qual \u00e8 il tuo sport preferito?"
17
  ],
18
+ "grounding_urls": [
19
+ "https://www.pnac.org/wp-content/uploads/Italian-Study-Guide.pdf"
20
+ ],
21
  "enable_dynamic_urls": true,
22
  "enable_file_upload": true,
23
+ "theme": "Default"
24
  }
requirements.txt CHANGED
@@ -1,4 +1,4 @@
1
- gradio>=5.39.0
2
  requests>=2.32.3
3
  beautifulsoup4>=4.12.3
4
  python-dotenv>=1.0.0
 
1
+ gradio>=5.42.0
2
  requests>=2.32.3
3
  beautifulsoup4>=4.12.3
4
  python-dotenv>=1.0.0