Skip to content

Commit bca39de

Browse files
committed
50% narrator
1 parent c459b50 commit bca39de

13 files changed

+31
-6
lines changed

Backend/Narrator.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,11 @@
55
import os,shutil
66
from urllib.parse import urlparse, urljoin
77

8-
openai.api_key = "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"
8+
openai.api_key = "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"
99
# Create an instance of APIRouter
1010
router = APIRouter()
1111

1212

13-
openai.api_key = "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"
1413

1514
# Process each paragraph and search for related images
1615
def process_paragraphs(paragraphs):
@@ -98,7 +97,7 @@ def api5_handler():
9897

9998
print(narrate)
10099
# Save topics to topics.txt
101-
with open('Files\generated_files\\narration.txt', 'w', encoding='utf-8') as file:
100+
with open('Local_Storage/Generated_Files/Narrator_Output/m1.txt', 'w', encoding='utf-8') as file:
102101
file.write(narrate)
103102

104103
image_name=extract_image_name(narrate)
@@ -116,7 +115,7 @@ def api5_handler():
116115
os.chdir("..")
117116

118117
while(True):
119-
with open('Files\generated_files\\response.txt', 'r',encoding='utf-8') as file:
118+
with open('Local_Storage/Generated_Files/response.txt', 'r',encoding='utf-8') as file:
120119
content = file.read()
121120
if len(content)==0:
122121
continue
@@ -125,10 +124,10 @@ def api5_handler():
125124
break
126125
if content[0]==".":
127126
narrate = extract_important_topics(content)
128-
with open('Files\generated_files\\narration.txt', 'w', encoding='utf-8') as file:
127+
with open('Local_Storage/Generated_Files/narration.txt', 'w', encoding='utf-8') as file:
129128
file.write(narrate)
130129
print(narrate)
131-
with open('Files\generated_files\\response.txt', 'w') as file:
130+
with open('Local_Storage/Generated_Files/response.txt', 'w') as file:
132131
# Truncate the file to remove its contents
133132
file.truncate()
134133
shutil.rmtree("images")
62 Bytes
Binary file not shown.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
Hello, let's talk about digital electronics and specifically about combinational and sequential circuits. Digital circuits are of two types: combinational circuits and sequential circuits. Combinational circuits only depend on the present inputs, while sequential circuits depend on both the present and past inputs.
2+
3+
To design a digital circuit, we follow a procedure that involves six steps: we start by stating the problem, then we determine the number of available input and required output variables, assign letter symbols to them, create a truth table that shows their relationship, simplify the Boolean function for each output, and finally draw the logic diagram.
4+
5+
For the most basic arithmetic operation, addition, we use adder circuits. There are two types of adder circuits: half-adder and full-adder. The half-adder uses two-input NOR gates to add two binary digits, while the full-adder adds two bits and a carry, and outputs a sum bit and a carrying bit. We can realize a full-adder circuit using an XOR gate and two AND gates.
6+
7+
If we want to subtract one bit from another, we can use a half-subtractor or a full-subtractor. The full-subtractor is a combinational circuit with three inputs and two outputs, and we can realize it with XOR gates and AOI gates.
8+
9+
If we want to add two binary numbers in parallel form, we use an n-bit parallel adder which consists of full adders connected in a chain. The carry-out of each full-adder is the carry-in to the next stage in a ripple carry adder. The subtraction of two binary numbers can be achieved by taking the 2's complement of one of them and adding it to the other.
10+
11+
We can speed up the addition process with a look-ahead-carry adder, which examines all the input bits simultaneously and generates the carry-in bits for all the stages simultaneously. The carry-in to each stage is the carry-out of the previous stage, and we get the following Boolean expressions for the final sum and carry outputs of the nth stage: Pn, Cn, P_, Pn-Cn-Sn, P-Sn, and C-Sn.
12+
13+
For code conversion, we use a logic circuit called a code converter that converts a bit-pattern representing numbers from one code to another code. For example, a 4-bit binary-to-Gray-code conversion circuit outputs a Gray-type code for a 4-bit binary input. We can also use a decoder to convert an N-bit-binary input code into M output lines, where only one output line is activated for each possible combination of inputs. Conversely, an encoder does the opposite of decoding, taking decimal digits and/or alphabetic characters and outputting the coded representations.
14+
15+
Finally, we discussed a magnitude comparator, which is a logic circuit that compares two quantities and gives an output signal indicating whether the two input quantities are equal or not. It compares the binary representations of the input quantities and gives the result of A=B, A>B, or A<B.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
Sure, a truth table is a tool used in logic to analyze the relationships between propositions. It consists of columns representing the different propositions and their possible truth values, as well as a final column representing the resulting truth value of the entire expression.
2+
3+
For example, let's say we have two propositions, P and Q. Each proposition can have one of two possible truth values - true or false. We can use a truth table to analyze the different possible combinations of truth values for P and Q and determine the truth value of the logical expression P AND Q, which represents the conjunction of the two propositions.
4+
5+
So, we would start by creating a table with two columns, one for P and one for Q. Then, we would fill in each row with a different combination of truth values for P and Q - true/false, true/true, false/false, and false/true.
6+
7+
Next, we would add a third column representing the truth value of the expression P AND Q. To determine the truth value of this expression for each row, we would simply apply the AND operator to the truth values of P and Q for that row.
8+
9+
After completing all the rows, we would have a complete truth table showing all the possible truth values for the expression P AND Q, given different truth values for P and Q. This can help us see patterns and relationships between different propositions, and is a powerful tool in understanding logical statements.
10+
11+
Does that help clarify the concept of truth tables for you?

Local_Storage/Generated_Files/response.txt

Whitespace-only changes.
1.43 KB
Loading
3.76 KB
Loading
6.58 KB
Loading
2.7 KB
Loading

images/images/image_5. Table.jpg

2.44 KB
Loading

0 commit comments

Comments
 (0)