borodache commited on
Commit
9ff2fd6
·
1 Parent(s): 14fca4c

try to read_csv2

Browse files
Files changed (3) hide show
  1. .idea/workspace.xml +28 -0
  2. app.py +36 -0
  3. requirements.txt +3 -0
.idea/workspace.xml CHANGED
@@ -31,6 +31,34 @@
31
  <property name="last_opened_file_path" value="$PROJECT_DIR$" />
32
  <property name="settings.editor.selected.configurable" value="com.jetbrains.python.configuration.PyActiveSdkModuleConfigurable" />
33
  </component>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
34
  <component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
35
  <component name="TaskManager">
36
  <task active="true" id="Default" summary="Default task">
 
31
  <property name="last_opened_file_path" value="$PROJECT_DIR$" />
32
  <property name="settings.editor.selected.configurable" value="com.jetbrains.python.configuration.PyActiveSdkModuleConfigurable" />
33
  </component>
34
+ <component name="RunManager">
35
+ <configuration name="app" type="PythonConfigurationType" factoryName="Python" temporary="true" nameIsGenerated="true">
36
+ <option name="INTERPRETER_OPTIONS" value="" />
37
+ <option name="PARENT_ENVS" value="true" />
38
+ <envs>
39
+ <env name="PYTHONUNBUFFERED" value="1" />
40
+ </envs>
41
+ <option name="SDK_HOME" value="C:\Users\borod\AppData\Local\Programs\Python\Python37\python.exe" />
42
+ <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
43
+ <option name="IS_MODULE_SDK" value="false" />
44
+ <option name="ADD_CONTENT_ROOTS" value="true" />
45
+ <option name="ADD_SOURCE_ROOTS" value="true" />
46
+ <module name="" />
47
+ <option name="SCRIPT_NAME" value="$PROJECT_DIR$/app.py" />
48
+ <option name="PARAMETERS" value="" />
49
+ <option name="SHOW_COMMAND_LINE" value="false" />
50
+ <option name="EMULATE_TERMINAL" value="false" />
51
+ <option name="MODULE_MODE" value="false" />
52
+ <option name="REDIRECT_INPUT" value="false" />
53
+ <option name="INPUT_FILE" value="" />
54
+ <method v="2" />
55
+ </configuration>
56
+ <recent_temporary>
57
+ <list>
58
+ <item itemvalue="Python.app" />
59
+ </list>
60
+ </recent_temporary>
61
+ </component>
62
  <component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
63
  <component name="TaskManager">
64
  <task active="true" id="Default" summary="Default task">
app.py CHANGED
@@ -1,4 +1,40 @@
1
  import gradio as gr
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
 
3
 
4
  def greet(name):
 
1
  import gradio as gr
2
+ from re import sub
3
+ from datasets import load_dataset
4
+ import pandas as pd
5
+
6
+
7
+ def clean_text(text):
8
+ """
9
+ Applies some pre-processing on the given text.
10
+
11
+ Steps :
12
+ - Lowering text
13
+ - Removing backslashes
14
+ - removes a. out of the answers
15
+ - replaces 'b.', 'c.', and 'd.' with comma ','
16
+ """
17
+ text = text.lower()
18
+ text = text.replace('\\', '') # generic replace was advised by Danit
19
+ text = text.replace('a.', '')
20
+ text = text.replace('b.', ',')
21
+ text = text.replace('c.', ',')
22
+ text = text.replace('d.', ',')
23
+ text = sub("\d+", "<num>", text)
24
+
25
+ return ' '.join(text.split())
26
+
27
+
28
+ dataset = load_dataset(
29
+ "csv",
30
+ data_files={
31
+ "train": "https://huggingface.co/borodache/science-classification/resolve/main/subjects-questions.csv"
32
+ },
33
+ use_auth_token=True,
34
+ )
35
+
36
+
37
+ # df = pd.read_csv("/subjects-questions.csv")
38
 
39
 
40
  def greet(name):
requirements.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ gradio
2
+ datasets
3
+ pandas