Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,7 +1,6 @@
|
|
| 1 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 2 |
import gradio as gr
|
| 3 |
import torch
|
| 4 |
-
import json
|
| 5 |
|
| 6 |
title = "????AI ChatBot"
|
| 7 |
description = "A State-of-the-Art Large-scale Pretrained Response generation model (DialoGPT)"
|
|
@@ -50,24 +49,6 @@ def predict(input, history=[]):
|
|
| 50 |
response = [(response[i], response[i + 1]) for i in range(0, len(response) - 1, 2)] # convert to tuples of list
|
| 51 |
return response, history
|
| 52 |
|
| 53 |
-
def read_json_file(file_path): # read json file test
|
| 54 |
-
with open(file_path, 'r') as file:
|
| 55 |
-
data = json.load(file)
|
| 56 |
-
return data
|
| 57 |
-
|
| 58 |
-
def main():
|
| 59 |
-
# List of file names
|
| 60 |
-
file_names = ['fileone.json', 'filesecond.json', 'filethird.json', 'filefourth.json', 'filefifth.json']
|
| 61 |
-
|
| 62 |
-
# Read each JSON file and print its content
|
| 63 |
-
for file_name in file_names:
|
| 64 |
-
json_data = read_json_file(file_name)
|
| 65 |
-
print(f"Contents of {file_name}:")
|
| 66 |
-
print(json_data)
|
| 67 |
-
print()
|
| 68 |
-
|
| 69 |
-
if __name__ == "__main__":
|
| 70 |
-
main()
|
| 71 |
|
| 72 |
gr.Interface(
|
| 73 |
fn=predict,
|
|
|
|
| 1 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 2 |
import gradio as gr
|
| 3 |
import torch
|
|
|
|
| 4 |
|
| 5 |
title = "????AI ChatBot"
|
| 6 |
description = "A State-of-the-Art Large-scale Pretrained Response generation model (DialoGPT)"
|
|
|
|
| 49 |
response = [(response[i], response[i + 1]) for i in range(0, len(response) - 1, 2)] # convert to tuples of list
|
| 50 |
return response, history
|
| 51 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 52 |
|
| 53 |
gr.Interface(
|
| 54 |
fn=predict,
|