Omnibus commited on
Commit
674de7c
·
verified ·
1 Parent(s): 2ae56ab

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +79 -2
app.py CHANGED
@@ -2,9 +2,86 @@ from textblob import TextBlob
2
  import gradio as gr
3
  import os
4
  os.system("python -m textblob.download_corpora")
5
- string_json={'control':'0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMN'}
6
  cont_list=list(string_json['control'])
7
- def get_nouns(text):
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
  json_object={}
9
  sen_list=[]
10
  noun_list={}
 
2
  import gradio as gr
3
  import os
4
  os.system("python -m textblob.download_corpora")
5
+ control_json={'control':'0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ','char':'','leng':62}
6
  cont_list=list(string_json['control'])
7
+
8
+
9
+
10
+
11
+ text="""
12
+ I asked Generative AI Models about their context window. Their response was intriguing.
13
+
14
+ The context window for a large language model (LLM) like OpenAI’s GPT refers to the maximum amount of text the model can consider at any one time when generating a response. This includes both the prompt provided by the user and the model’s generated text.
15
+
16
+ In practical terms, the context window limits how much previous dialogue the model can “remember” during an interaction. If the interaction exceeds the context window, the model loses access to the earliest parts of the conversation. This limitation can impact the model’s consistency in long conversations or complex tasks.
17
+ """
18
+
19
+ def assign_val(inp, rng, cnt, limit):
20
+ if go:
21
+ for ea in range(rng):
22
+ if go:
23
+ noun_list[str(noun)].append(f'{a}{cont_list[b]}{cont_list[c]}{cont_list[d]}')
24
+
25
+ if json_object[f'{a}{cont_list[b]}{cont_list[c]}{cont_list[d]}']=='ZNNN':
26
+ a="Y"
27
+ b=0
28
+ c=0
29
+ d=0
30
+
31
+
32
+ if cnt == key_cnt-1:
33
+ print('done')
34
+ go=False
35
+ print(list(json_object.keys())[-1])
36
+ else:
37
+ cnt+=1
38
+
39
+
40
+ def get_nouns(text=text,steps=1):
41
+ control_len=control_json['leng']-steps
42
+ control_char=list(control_json['control'][:control_len])
43
+ control_val=list(control_json['control'][control_len:-1])
44
+ char_len=len(control_char)
45
+ val_len=len(control_val)
46
+ print(control_new)
47
+ print(control_char)
48
+ json_object={}
49
+ sen_list=[]
50
+ noun_list={}
51
+ noun_box=[]
52
+ blob = TextBlob(text)
53
+ for sentence in blob.sentences:
54
+ sen_list.append(str(sentence))
55
+
56
+ key_cnt=len(sen_list)
57
+ cnt=0
58
+ go=True
59
+ a="Z"
60
+ if go:
61
+ for i,ea in enumerate(range(steps)):
62
+
63
+ if go:
64
+ for ii,sent in enumerate(sen_list):
65
+
66
+ #for iii in
67
+ noun_list[f'{control_val[i]}{control_char[ii]}']=sent
68
+
69
+ if cnt == key_cnt-1:
70
+ print('done')
71
+ go=False
72
+ print(list(json_object.keys())[-1])
73
+ else:
74
+ cnt+=1
75
+
76
+
77
+
78
+
79
+ def get_nouns_OG(text,steps=1):
80
+ control_len=control_json['leng']-steps
81
+ control_new=control_json['control'][:control_len]
82
+ control_char=control_json['control'][control_len:-1]
83
+ print(control_new)
84
+ print(control_char)
85
  json_object={}
86
  sen_list=[]
87
  noun_list={}