File size: 579 Bytes
278cdf2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import gradio as gr

def greet(Batch, file):
    import re
    # with open(file, encoding = 'utf-8') as f:
    placed = set()
    print(file)
    file.seek(0)
    cont = file.read()
    print(cont)
    chat = re.split('../../.., *', cont.decode('utf-8'))
    for msg in chat:
        if 'acceptance' in msg:
            print(re.findall(': (.)FTE',msg), sorted(re.findall('(?i)2k19/co/[0-9]',msg)))
            placed.update(re.findall(f'(?i){Batch}/[0-9]*', msg))
    return str(len(placed))

demo = gr.Interface(fn=greet, inputs=["text", "file"], outputs="text")
demo.launch()