Spaces:
Sleeping
Sleeping
Added examples and file upload feature
Browse files
app.py
CHANGED
@@ -1,3 +1,4 @@
|
|
|
|
1 |
import subprocess
|
2 |
import sys
|
3 |
|
@@ -24,7 +25,77 @@ def get_keywords(course_name, course_desc):
|
|
24 |
keywords = key_model.extract_keywords(data, vectorizer=vectorizer_params, stop_words='english', top_n=7, use_mmr=True)
|
25 |
keywords_list = list(dict(keywords).keys())
|
26 |
return ", ".join(keywords_list)
|
27 |
-
|
28 |
-
|
29 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
iface.launch()
|
|
|
1 |
+
import pandas as pd
|
2 |
import subprocess
|
3 |
import sys
|
4 |
|
|
|
25 |
keywords = key_model.extract_keywords(data, vectorizer=vectorizer_params, stop_words='english', top_n=7, use_mmr=True)
|
26 |
keywords_list = list(dict(keywords).keys())
|
27 |
return ", ".join(keywords_list)
|
28 |
+
|
29 |
+
def get_keywords_file(file):
|
30 |
+
input_data = pd.read_csv(file)
|
31 |
+
keywords_data = []
|
32 |
+
for i in range(len(input_data)):
|
33 |
+
curr_keywords = get_keywords(input_data["Course Name"][i], input_data["Course Desc"][i])
|
34 |
+
keywords_data.append(curr_keywords)
|
35 |
+
input_data["Relevant Tags"] = keywords_data
|
36 |
+
|
37 |
+
output_file = "CourseTagGen_Result.csv"
|
38 |
+
input_data.to_csv(output_file)
|
39 |
+
return output_file
|
40 |
+
|
41 |
+
course_ex = [["Biotechnology",
|
42 |
+
"""
|
43 |
+
Biotechnology is one of the fastest moving fields in the biosciences. Genetic engineering techniques have allowed the manipulation of microorganisms, plants and animals to produce commercially important compounds, or to have improved characteristics. This module examines the techniques that are used in genetic manipulation and looks at examples of how the technology has been applied. The practical outcomes of genome sequencing projects and the way in which knowledge of the human genome can be applied to medicine and forensics are also considered. Practical classes and workshops allow students to perform some of the key techniques for themselves.
|
44 |
+
|
45 |
+
This course aims to provide an understanding, at a basic level, of the diverse ways in which the biological processes of plants, microbes and animals can be manipulated for benefit, and to demonstrate how biotechnology influences our everyday lives.
|
46 |
+
"""
|
47 |
+
],
|
48 |
+
["Intelligent System Control",
|
49 |
+
"""
|
50 |
+
This module introduces students to the design and application of intelligent control systems, with a focus on modern algorithmic, computer-aided design methods. Starting from the well-known proportional-integral algorithm, essential concepts such as digital and optimal control are introduced using straightforward algebra and block diagrams. The module addresses the needs of students across the engineering discipline who would like to advance their knowledge of automatic control and optimisation, with practical worked-examples from robotics, industrial process control and environmental systems, among other areas. This module also introduces students to statistical modelling concepts that are rather different to classical engineering model development based on physical equations. These methods have wide ranging application for control, signal processing, and forecasting, with applications beyond engineering into medicine, economics, environment sciences, and so on.
|
51 |
+
|
52 |
+
On successful completion of this module students will:
|
53 |
+
Understand various hierarchical architectures of intelligent control;
|
54 |
+
Be able to analyse and design discrete-time models and digital control systems;
|
55 |
+
Be able to design optimal model-based control systems;
|
56 |
+
Identify mathematical models from engineering data;
|
57 |
+
Design and evaluate system performance;
|
58 |
+
Be able to use statistical tools for the analysis of data;
|
59 |
+
Be able to use modern computational aids for the design of control systems;
|
60 |
+
Appreciate cutting-edge research developments in these areas;
|
61 |
+
Demonstrate an understanding of the control objectives and practical constraints, and be able to suggest design solutions for a range of case study examples.
|
62 |
+
"""],
|
63 |
+
["Migration, Citizenship and Belonging",
|
64 |
+
"""
|
65 |
+
'Belonging' to a nation is widely seen to be as 'natural' as 'belonging' to a family or a home. This course undermines assumptions about national belonging by introducing students to a range of theoretical approaches and debates. How are the nation and national belonging socially constructed? How is the nation defined? Who belongs, who doesn't? What are the impacts of migration on definitions of the nation? In turn, how is migration enabled or constricted by national borders and boundaries?
|
66 |
+
|
67 |
+
The module focuses on nation formation in relation to migration. It will explore what everyday practices, discourses, and policies reveal about the ways we think about, and inhabit, the nation and migration? Although we will focus on the example of Britain, the issues raised will be of interest to all students concerned with the effects of nationalisms and ideas of belonging and entitlement, which many countries of the contemporary world are presently debating in the context of the 'Age of migration' (Castles and Miller 1998).
|
68 |
+
|
69 |
+
Examples of topics covered include: ‘We the people’ – the forging of nations; the racial state; gender, sexuality and the nation; migration, citizenship, and integration; language as border control.
|
70 |
+
|
71 |
+
This course aims:
|
72 |
+
To introduce sociological issues surrounding the concepts of nation, migration and multiculturalism
|
73 |
+
To develop an understanding of discourse analysis
|
74 |
+
To introduce questions of power and politics surrounding the processes of identity formation
|
75 |
+
"""]
|
76 |
+
]
|
77 |
+
|
78 |
+
table_md = """
|
79 |
+
| Course Name | Course Desc |
|
80 |
+
|----------------|-------------------|
|
81 |
+
| Course A | Desc Course A |
|
82 |
+
| Course B | Desc Course B |
|
83 |
+
| ... | ... |
|
84 |
+
"""
|
85 |
+
first_tab = gr.Interface(fn=get_keywords,
|
86 |
+
inputs=[gr.Textbox(label="Course Name"),
|
87 |
+
gr.Textbox(label="Course Description")],
|
88 |
+
outputs=gr.Textbox(label="Relevant Tags", max_lines=200),
|
89 |
+
description="Generating tags/keywords based on Keyphrase-BERT Extraction",
|
90 |
+
examples=course_ex)
|
91 |
+
|
92 |
+
second_tab = gr.Interface(fn=get_keywords_file,
|
93 |
+
inputs=gr.File(label="Upload a CSV file"),
|
94 |
+
outputs=gr.File(label="Upload a CSV file"),
|
95 |
+
description=f"Generating tags/keywords based on Keyphrase-BERT Extraction\n\nFollow this column name format!\n{table_md}")
|
96 |
+
|
97 |
+
iface = gr.TabbedInterface(interface_list=[first_tab, second_tab],
|
98 |
+
tab_names=["Generate From Text Input", "Generate From CSV/XLSX"],
|
99 |
+
title="College Course Tags Generator")
|
100 |
+
|
101 |
iface.launch()
|