dieineb commited on
Commit
0f85536
·
1 Parent(s): c062c58

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -17
app.py CHANGED
@@ -1,32 +1,31 @@
1
  from statistics import mode
2
  import urllib.request
3
  import gradio as gr
 
4
  import unidecode
 
5
  import string
6
  import json
7
 
8
- urllib.request.urlretrieve(
9
- 'https://drive.google.com/uc?export=download&id=1TXD41vfqNWA6UNDQ73WhtJdZivCJatn-',
10
- 'bot_questions_tags.json'
11
- )
12
 
13
- answers = ['Hello! My name is Ai.ra, and I am an artificial intelligence (AI). More specifically, I am an NLP (Natural Language Processing) model trained in conversation (a chatbot!).',
14
- 'You can ask me things about "Artificial Intelligence," "Machine Learning," "AI Safety," or "AI Ethics."',
15
- "I don't have that kind of property hahaha I am software!",
16
- "AIRES (AI Robotics Ethics Society) is a society focused on educating the leaders and developers of tomorrow's Artificial Intelligence (AI) to ensure that AI is created ethically and responsibly.",
17
- 'Aron Hui is the president/founder of AIRES.',
18
- 'What "intelligence" is, remains an open question. However, not to leave you in the lurch, I will define "intelligence" as follows: "Intelligence is the ability of an agent to achieve goals in a wide range of environments."',
19
- 'There is no consensus in the literature on what "AI" is (a corollary of not having a robust definition of what "intelligence\'\' is). However, we can say that AI is the intelligence demonstrated by machines, as opposed to the natural intelligence possessed by animals and humans.',
20
- 'General Intelligence, or Universal Intelligence, can be defined as the ability to efficiently achieve goals in a wide range of domains.',
21
- 'GOFAI ("good-old-fashioned-ai"), or symbolic artificial intelligence, is the term used to refer to methods of developing AI systems based on high-level symbolic (interpretable) representations, logic, and search.',
22
- 'A multi-agent system (MAS "Multi-Agent Systems") is a computer system composed of multiple interacting intelligent agents.',
23
- 'Machine Learning (ML) is a field of research dedicated to understanding and building methods that "learn", i.e., methods that use information/data to improve performance on some tasks.']
24
 
 
 
25
 
26
- with open('bot_questions_tags.json') as json_file:
27
- dictionary = json.load(json_file)
 
 
 
 
28
 
29
 
 
 
 
30
  def generate_ngrams(text, WordsToCombine):
31
  """
32
  Generates n-grams of length WordsToCombine from the input text.
 
1
  from statistics import mode
2
  import urllib.request
3
  import gradio as gr
4
+ import subprocess
5
  import unidecode
6
+ import requests
7
  import string
8
  import json
9
 
 
 
 
 
10
 
11
+ # Download files using wget
12
+ keys_url = "https://github.com/Nkluge-correa/Aira/raw/master/Aira-1/data/generated_data/keys_en.json"
13
+ answers_url = "https://github.com/Nkluge-correa/Aira/raw/master/Aira-1/data/original_data/answers_en.txt"
 
 
 
 
 
 
 
 
14
 
15
+ subprocess.run(["wget", keys_url, "-O", "keys_en.json"])
16
+ subprocess.run(["wget", answers_url, "-O", "answers_en.txt"])
17
 
18
+ # Load data from files
19
+ with open('answers_en.txt', encoding='utf-8') as fp:
20
+ answers = [line.strip() for line in fp]
21
+
22
+ with open('keys_en.json', 'r') as fp:
23
+ vocabulary = json.load(fp)
24
 
25
 
26
+ with open('keys_en.json') as json_file:
27
+ dictionary = json.load(json_file)
28
+
29
  def generate_ngrams(text, WordsToCombine):
30
  """
31
  Generates n-grams of length WordsToCombine from the input text.